]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_caps.erl: Bugfix in timeout checking. Check for timeout
authorBadlop <badlop@process-one.net>
Fri, 21 Dec 2007 23:36:44 +0000 (23:36 +0000)
committerBadlop <badlop@process-one.net>
Fri, 21 Dec 2007 23:36:44 +0000 (23:36 +0000)
when an error response is received, and also before querying

SVN Revision: 1095

ChangeLog
src/mod_caps.erl

index c725e5394c7fe21ae01189443deb8713cd76d26d..87f6e6f1c5a5b5a2e99f4473e277ee6c68f7a4c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-22  Badlop  <badlop@process-one.net>
+
+       * src/mod_caps.erl: Bugfix in timeout checking. Check for timeout
+       when an error response is received, and also before querying
+
 2007-12-21  Badlop  <badlop@process-one.net>
 
        * src/ejabberd_ctl.erl: Added new command: mnesia (thanks to
index a5ae8bbbcd1689ac6b93da299dd91db50a768dd6..d341677ee9f75641e24139d510806982b4eccf23 100644 (file)
@@ -146,6 +146,7 @@ handle_call({get_features, Caps}, From, State) ->
        {ok, Features} -> 
            {reply, Features, State};
        wait ->
+           gen_server:cast(self(), visit_feature_queries),
            Timeout = timestamp() + 10,
            FeatureQueries = State#state.feature_queries,
            NewFeatureQueries = [{From, Caps, Timeout} | FeatureQueries],
@@ -221,6 +222,9 @@ handle_cast({disco_response, From, _To,
                error ->
                    ?ERROR_MSG("ID '~s' matches no query", [ID])
            end;
+       {error, _} ->
+           gen_server:cast(self(), visit_feature_queries),
+           ?ERROR_MSG("Error IQ reponse IQ from ~s: ~p", [jlib:jid_to_string(From), SubEls]);
        {result, _} ->
            ?ERROR_MSG("Invalid IQ contents from ~s: ~p", [jlib:jid_to_string(From), SubEls]);
        _ ->
@@ -234,7 +238,7 @@ handle_cast(visit_feature_queries, #state{feature_queries = FeatureQueries} = St
     NewFeatureQueries =
        lists:foldl(fun({From, Caps, Timeout}, Acc) ->
                            case maybe_get_features(Caps) of
-                               wait when Timeout < Timestamp -> [{From, Caps, Timeout} | Acc];
+                               wait when Timeout > Timestamp -> [{From, Caps, Timeout} | Acc];
                                wait -> Acc;
                                {ok, Features} ->
                                    gen_server:reply(From, Features),