Browse Source

Don't crash on Transport:controlling_process return in the acceptor.

Crashes can happen if we close the connection too fast, leading to
controlling_process returning {error, closed} instead of ok. This can
happen when we receive bad requests, reply with 404 Not Found and more.
Simply do not match the return value of controlling_process to avoid this.
Loïc Hoguin 14 years ago
parent
commit
a77b906b9f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/cowboy_acceptor.erl

+ 1 - 1
src/cowboy_acceptor.erl

@@ -35,7 +35,7 @@ acceptor(LSocket, Transport, Protocol, Opts) ->
 		{ok, CSocket} ->
 			{ok, Pid} = supervisor:start_child(cowboy_protocols_sup,
 				[CSocket, Transport, Protocol, Opts]),
-			ok = Transport:controlling_process(CSocket, Pid);
+			Transport:controlling_process(CSocket, Pid);
 		{error, _Reason} ->
 			%% @todo Probably do something here. If the socket was closed,
 			%%       we may want to try and listen again on the port?