diff options
author | Evgeny Khramtsov <xramtsov@gmail.com> | 2014-05-27 15:44:04 +0400 |
---|---|---|
committer | Evgeny Khramtsov <xramtsov@gmail.com> | 2014-05-27 15:44:04 +0400 |
commit | 702cddd4fff2388402926c4049909ad628c6b5bd (patch) | |
tree | 6cc1eec50a7ca74cffb15df576d30e64c4765f1c | |
parent | Merge pull request #222 from weiss/keep-session-on-failed-resume (diff) | |
parent | XEP-0198: Don't exit on socket send failure (diff) |
Merge pull request #220 from weiss/handle-send-failure
XEP-0198: Don't exit on socket send failure
-rw-r--r-- | src/ejabberd_c2s.erl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 43bce7d0d..6aebefdd6 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -1812,6 +1812,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). |