]> granicus.if.org Git - ejabberd/commitdiff
Handle TCP errors in websockets
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Thu, 9 May 2019 19:06:23 +0000 (22:06 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Thu, 9 May 2019 19:06:23 +0000 (22:06 +0300)
src/ejabberd_websocket.erl

index e954b42c2f7a7ff3e08417a6d81296d5493e8bbf..2dde8add2a20eeeee99e2821f3c7fffcadcbb4a6 100644 (file)
@@ -203,6 +203,9 @@ ws_loop(FrameInfo, Socket, WsHandleLoopPid, SocketMode) ->
         {tcp_closed, _Socket} ->
             ?DEBUG("tcp connection was closed, exit", []),
             websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
+       {tcp_error, Socket, Reason} ->
+           ?DEBUG("tcp connection error: ~s", [inet:format_error(Reason)]),
+           websocket_close(Socket, WsHandleLoopPid, SocketMode, 0);
         {'DOWN', Ref, process, WsHandleLoopPid, Reason} ->
             Code = case Reason of
                        normal ->