When iq:version returns timeout, store unknown information

This commit is contained in:
Badlop 2023-05-04 16:50:01 +02:00
parent 0bccf45c0e
commit b0b62f509c
1 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@
-export([start/2, stop/1, depends/2, mod_opt_type/1, mod_options/1, mod_doc/0, mod_status/0]). -export([start/2, stop/1, depends/2, mod_opt_type/1, mod_options/1, mod_doc/0, mod_status/0]).
-export([loop/1, get_statistic/2, -export([loop/1, get_statistic/2,
pre_uninstall/0, pre_uninstall/0,
received_response/3, received_response/3, received_response/7,
%% Commands %% Commands
getstatsdx/1, getstatsdx/2, getstatsdx/1, getstatsdx/2,
get_top_users/2, get_top_users/2,
@ -821,13 +821,15 @@ request_iqversion(User, Host, Resource) ->
IQ = #iq{type = get, IQ = #iq{type = get,
from = From, from = From,
to = To, to = To,
id = p1_rand:get_string(),
sub_els = [Query]}, sub_els = [Query]},
HandleResponse = fun(#iq{type = Type} = IQr) when (Type == result) or (Type == error) -> HandleResponse = fun(#iq{type = Type} = IQr) when (Type == result) or (Type == error) ->
spawn(?MODULE, received_response, spawn(?MODULE, received_response,
[To, From, IQr]); [To, From, IQr]);
(timeout) ->
spawn(?MODULE, received_response,
[To, unknown, unknown, <<"">>, "unknown", "unknown", "unknown"]);
(R) -> (R) ->
?INFO_MSG("Unexpected response: ~n~p", [R]), ?INFO_MSG("Unexpected response: ~n~p", [{User, Host, Resource, R}]),
ok % Hmm. ok % Hmm.
end, end,
ejabberd_router:route_iq(IQ, HandleResponse). ejabberd_router:route_iq(IQ, HandleResponse).