From a77b906b9f753b7ca30f4979551af0ac699b34ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 17 Mar 2011 22:22:09 +0100 Subject: 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. --- src/cowboy_acceptor.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cowboy_acceptor.erl') diff --git a/src/cowboy_acceptor.erl b/src/cowboy_acceptor.erl index 9c35edb..d4d7f5c 100644 --- a/src/cowboy_acceptor.erl +++ b/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? -- cgit v1.2.3