Skip to content
Browse files
XEP-0198: Don't exit on socket send failure
If stream management is enabled, don't exit the c2s process when
ejabberd_socket:send/2 fails, but close the socket instead.  This gives
the client a chance to resume the session.

Thanks go to Matthias Rieber for reporting the issue, providing detailed
logs, and testing the fix.
  • Loading branch information
weiss committed May 23, 2014
1 parent 6baf3a2 commit ab9667f9178548fcb6d68f1028cdfc2e727cac8a
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/ejabberd_c2s.erl
@@ -1811,6 +1811,14 @@ send_text(StateData, Text) when StateData#state.xml_socket ->
?DEBUG("Send Text on stream = ~p", [Text]),
{xmlstreamraw, Text});
send_text(StateData, Text) when StateData#state.mgmt_state == active ->
?DEBUG("Send XML on stream = ~p", [Text]),
case catch (StateData#state.sockmod):send(StateData#state.socket, Text) of
{'EXIT', _} ->
_ ->
send_text(StateData, Text) ->
?DEBUG("Send XML on stream = ~p", [Text]),
(StateData#state.sockmod):send(StateData#state.socket, Text).

0 comments on commit ab9667f

Please sign in to comment.