25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

* src/mod_caps.erl: Bugfix in timeout checking. Check for timeout

when an error response is received, and also before querying

SVN Revision: 1095
This commit is contained in:
Badlop 2007-12-21 23:36:44 +00:00
parent d1f902768c
commit 43fc8b3329
2 changed files with 10 additions and 1 deletions

View File

@ -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

View 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),