25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-31 15:21:38 +01:00

Catch exception that may happen when sending data over websocket

This fixes #1667
This commit is contained in:
Paweł Chmielowski 2017-06-23 17:19:28 +02:00
parent bb39ecbc08
commit 70606d7f1a

View File

@ -81,8 +81,14 @@ start_link(WS) ->
gen_fsm:start_link(?MODULE, [WS], ?FSMOPTS).
send_xml({http_ws, FsmRef, _IP}, Packet) ->
gen_fsm:sync_send_all_state_event(FsmRef,
{send_xml, Packet}).
case catch gen_fsm:sync_send_all_state_event(FsmRef,
{send_xml, Packet},
15000)
of
{'EXIT', {timeout, _}} -> {error, timeout};
{'EXIT', _} -> {error, einval};
Res -> Res
end.
setopts({http_ws, FsmRef, _IP}, Opts) ->
case lists:member({active, once}, Opts) of