Set c2s_closed priority in mod_statsdx lower than in mod_stream_mgmt

If c2s_closed reason is [{socket,ping_timeout}],
mod_stream_mgmt stops the hook (see c2s_closed/2)
and mod_statsdx doesn't notice the client disconnection.
To reproduce: login with Xabber-Android, then disable Wifi in that mobile
and wait for mod_ping to kill the connection.
This commit is contained in:
Badlop 2021-12-31 20:11:30 +01:00
parent 3b116414db
commit 03cd4de6b0
1 changed files with 3 additions and 3 deletions

View File

@ -195,7 +195,7 @@ prepare_stats_host(Host, Hooks, CD) ->
ejabberd_hooks:add(register_user, Host, ?MODULE, register_user, 90),
ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 90),
ejabberd_hooks:add(c2s_session_opened, Host, ?MODULE, user_login, 90),
ejabberd_hooks:add(c2s_closed, Host, ?MODULE, user_logout, 90),
ejabberd_hooks:add(c2s_closed, Host, ?MODULE, user_logout, 40),
%%ejabberd_hooks:add(sm_remove_connection_hook, Host, ?MODULE, user_logout_sm, 90),
ejabberd_hooks:add(user_send_packet, Host, ?MODULE, user_send_packet, 90);
traffic ->
@ -204,7 +204,7 @@ prepare_stats_host(Host, Hooks, CD) ->
ejabberd_hooks:add(register_user, Host, ?MODULE, register_user, 90),
ejabberd_hooks:add(remove_user, Host, ?MODULE, remove_user, 90),
ejabberd_hooks:add(c2s_session_opened, Host, ?MODULE, user_login, 90),
ejabberd_hooks:add(c2s_closed, Host, ?MODULE, user_logout, 90),
ejabberd_hooks:add(c2s_closed, Host, ?MODULE, user_logout, 40),
%%ejabberd_hooks:add(sm_remove_connection_hook, Host, ?MODULE, user_logout_sm, 90),
ejabberd_hooks:add(user_send_packet, Host, ?MODULE, user_send_packet, 90);
false ->
@ -224,7 +224,7 @@ finish_stats() ->
finish_stats(Host) ->
ejabberd_hooks:delete(c2s_session_opened, Host, ?MODULE, user_login, 90),
ejabberd_hooks:delete(c2s_closed, Host, ?MODULE, user_logout, 90),
ejabberd_hooks:delete(c2s_closed, Host, ?MODULE, user_logout, 40),
%%ejabberd_hooks:delete(sm_remove_connection_hook, Host, ?MODULE, user_logout_sm, 90),
ejabberd_hooks:delete(user_send_packet, Host, ?MODULE, user_send_packet, 90),
ejabberd_hooks:delete(user_send_packet, Host, ?MODULE, user_send_packet_traffic, 92),