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.
This commit is contained in:
parent
6baf3a24de
commit
ab9667f917
|
@ -1811,6 +1811,14 @@ send_text(StateData, Text) when StateData#state.xml_socket ->
|
|||
?DEBUG("Send Text on stream = ~p", [Text]),
|
||||
(StateData#state.sockmod):send_xml(StateData#state.socket,
|
||||
{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', _} ->
|
||||
(StateData#state.sockmod):close(StateData#state.socket);
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
send_text(StateData, Text) ->
|
||||
?DEBUG("Send XML on stream = ~p", [Text]),
|
||||
(StateData#state.sockmod):send(StateData#state.socket, Text).
|
||||
|
|
Loading…
Reference in New Issue