aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Khramtsov <xramtsov@gmail.com>2014-05-27 15:44:04 +0400
committerEvgeny Khramtsov <xramtsov@gmail.com>2014-05-27 15:44:04 +0400
commit702cddd4fff2388402926c4049909ad628c6b5bd (patch)
tree6cc1eec50a7ca74cffb15df576d30e64c4765f1c
parentMerge pull request #222 from weiss/keep-session-on-failed-resume (diff)
parentXEP-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.erl8
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).