aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pawel@process-one.net>2022-02-02 18:33:45 +0100
committerPaweł Chmielowski <pawel@process-one.net>2022-02-02 18:33:45 +0100
commit11c725018bdd156a5a31129656448782aef3e81a (patch)
treee5200174aeedb105978daff41e88a1429933cd26
parentOne more place where we need to handle socket field not being available (diff)
Make dialyzer happy
-rw-r--r--src/ejabberd_c2s.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 3033501cf..a62cac79a 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -289,8 +289,10 @@ process_terminated(#{sid := SID, jid := JID, user := U, server := S, resource :=
Reason) ->
Status = format_reason(State, Reason),
?INFO_MSG("(~ts) Closing c2s session for ~ts: ~ts",
- [case State of #{socket := Socket} -> xmpp_socket:pp(Socket); _ -> <<"unknown">> end,
- jid:encode(JID), Status]),
+ [case maps:find(socket, State) of
+ {ok, Socket} -> xmpp_socket:pp(Socket);
+ _ -> <<"unknown">>
+ end, jid:encode(JID), Status]),
Pres = #presence{type = unavailable,
from = JID,
to = jid:remove_resource(JID)},
@@ -307,8 +309,10 @@ process_terminated(#{sid := SID, jid := JID, user := U, server := S, resource :=
State1;
process_terminated(#{stop_reason := {tls, _}} = State, Reason) ->
?WARNING_MSG("(~ts) Failed to secure c2s connection: ~ts",
- [case State of #{socket := Socket} -> xmpp_socket:pp(Socket); _ -> <<"unknown">> end,
-format_reason(State, Reason)]),
+ [case maps:find(socket, State) of
+ {ok, Socket} -> xmpp_socket:pp(Socket);
+ _ -> <<"unknown">>
+ end, format_reason(State, Reason)]),
State;
process_terminated(State, _Reason) ->
State.