aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_acceptor.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-17 22:22:09 +0100
committerLoïc Hoguin <[email protected]>2011-03-17 22:22:09 +0100
commita77b906b9f753b7ca30f4979551af0ac699b34ad (patch)
tree15130e0bf61cb4d6ed2ac5e06cfc2c5e0f847450 /src/cowboy_acceptor.erl
parent0069e2465d5b8343e06775a3f85693869a05f3c4 (diff)
downloadcowboy-a77b906b9f753b7ca30f4979551af0ac699b34ad.tar.gz
cowboy-a77b906b9f753b7ca30f4979551af0ac699b34ad.tar.bz2
cowboy-a77b906b9f753b7ca30f4979551af0ac699b34ad.zip
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.
Diffstat (limited to 'src/cowboy_acceptor.erl')
-rw-r--r--src/cowboy_acceptor.erl2
1 files changed, 1 insertions, 1 deletions
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?