Browse Source

call websocket_terminate in case of a handshake error

Andre Graf 12 years ago
parent
commit
ae2a6cfb68
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/cowboy_websocket.erl

+ 2 - 1
src/cowboy_websocket.erl

@@ -175,7 +175,8 @@ websocket_handshake(State=#state{socket=Socket, transport=Transport,
 			handler_before_loop(State#state{messages=Transport:messages()},
 				Req4, HandlerState, <<>>);
 		_Any ->
-			closed %% If an error happened reading the body, stop there.
+			%% If an error happened reading the body, stop there.
+			handler_terminate(State, Req3, HandlerState, {error, closed})
 	end;
 websocket_handshake(State=#state{transport=Transport, challenge=Challenge},
 		Req, HandlerState) ->