mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-12 21:52:07 +02:00
Don't expect that socket will be available in c2s_terminated hook
For detached connection we free socket, so let's make code account for this (and we really need it for printing debug informations). This makes sure we call ejabberd_sm:close_session
This commit is contained in:
parent
cae4fbb40b
commit
8824a912ef
|
@ -285,12 +285,12 @@ process_closed(State, Reason) ->
|
||||||
stop_async(self()),
|
stop_async(self()),
|
||||||
State#{stop_reason => Reason}.
|
State#{stop_reason => Reason}.
|
||||||
|
|
||||||
process_terminated(#{sid := SID, socket := Socket,
|
process_terminated(#{sid := SID, jid := JID, user := U, server := S, resource := R} = State,
|
||||||
jid := JID, user := U, server := S, resource := R} = State,
|
|
||||||
Reason) ->
|
Reason) ->
|
||||||
Status = format_reason(State, Reason),
|
Status = format_reason(State, Reason),
|
||||||
?INFO_MSG("(~ts) Closing c2s session for ~ts: ~ts",
|
?INFO_MSG("(~ts) Closing c2s session for ~ts: ~ts",
|
||||||
[xmpp_socket:pp(Socket), jid:encode(JID), Status]),
|
[case State of #{socket := Socket} -> xmpp_socket:pp(Socket); _ -> <<"unknown">> end,
|
||||||
|
jid:encode(JID), Status]),
|
||||||
Pres = #presence{type = unavailable,
|
Pres = #presence{type = unavailable,
|
||||||
from = JID,
|
from = JID,
|
||||||
to = jid:remove_resource(JID)},
|
to = jid:remove_resource(JID)},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user