mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
improve waiting caps clean (EJAB-1054)
SVN Revision: 2627
This commit is contained in:
parent
1c585e74bc
commit
726545ae86
@ -149,6 +149,8 @@ get_user_resources(LUser, LServer) ->
|
|||||||
note_caps(Host, From, Caps) ->
|
note_caps(Host, From, Caps) ->
|
||||||
case Caps of
|
case Caps of
|
||||||
nothing ->
|
nothing ->
|
||||||
|
BJID = jid_to_binary(From),
|
||||||
|
catch mnesia:dirty_delete({user_caps, BJID}),
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
@ -362,7 +364,7 @@ handle_cast({note_caps, From,
|
|||||||
ejabberd_local:register_iq_response_handler
|
ejabberd_local:register_iq_response_handler
|
||||||
(Host, ID, ?MODULE, handle_disco_response),
|
(Host, ID, ?MODULE, handle_disco_response),
|
||||||
ejabberd_router:route(jlib:make_jid("", Host, ""), From, Stanza),
|
ejabberd_router:route(jlib:make_jid("", Host, ""), From, Stanza),
|
||||||
timer:send_after(?CAPS_QUERY_TIMEOUT, self(), {disco_timeout, ID}),
|
timer:send_after(?CAPS_QUERY_TIMEOUT, self(), {disco_timeout, ID, BJID}),
|
||||||
?DICT:store(ID, node_to_binary(Node, SubNode), Dict)
|
?DICT:store(ID, node_to_binary(Node, SubNode), Dict)
|
||||||
end, Requests, Missing),
|
end, Requests, Missing),
|
||||||
{noreply, State#state{disco_requests = NewRequests}}
|
{noreply, State#state{disco_requests = NewRequests}}
|
||||||
@ -409,10 +411,11 @@ handle_cast({disco_response, From, _To,
|
|||||||
end,
|
end,
|
||||||
NewRequests = ?DICT:erase(ID, Requests),
|
NewRequests = ?DICT:erase(ID, Requests),
|
||||||
{noreply, State#state{disco_requests = NewRequests}};
|
{noreply, State#state{disco_requests = NewRequests}};
|
||||||
handle_cast({disco_timeout, ID}, #state{host = Host, disco_requests = Requests} = State) ->
|
handle_cast({disco_timeout, ID, BJID}, #state{host = Host, disco_requests = Requests} = State) ->
|
||||||
%% do not wait a response anymore for this IQ, client certainly will never answer
|
%% do not wait a response anymore for this IQ, client certainly will never answer
|
||||||
NewRequests = case ?DICT:is_key(ID, Requests) of
|
NewRequests = case ?DICT:is_key(ID, Requests) of
|
||||||
true ->
|
true ->
|
||||||
|
catch mnesia:dirty_delete({user_caps, BJID}),
|
||||||
ejabberd_local:unregister_iq_response_handler(Host, ID),
|
ejabberd_local:unregister_iq_response_handler(Host, ID),
|
||||||
?DICT:erase(ID, Requests);
|
?DICT:erase(ID, Requests);
|
||||||
false ->
|
false ->
|
||||||
|
Loading…
Reference in New Issue
Block a user