diff options
author | Loïc Hoguin <[email protected]> | 2011-04-30 22:26:56 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-04-30 22:26:56 +0200 |
commit | 65048fa6578926625ce7b77c03b06c981fc08609 (patch) | |
tree | b1717f694597119a1b0097b2a31c4214c0f41c4c /src/cowboy_tcp_transport.erl | |
parent | c044fa9602fb9ef39e8dc2bf28ac44ebb638a265 (diff) | |
download | cowboy-65048fa6578926625ce7b77c03b06c981fc08609.tar.gz cowboy-65048fa6578926625ce7b77c03b06c981fc08609.tar.bz2 cowboy-65048fa6578926625ce7b77c03b06c981fc08609.zip |
Add backlog transport option.
This fixes issues with the http_load benchmark tool. The default backlog
option from OTP only queues up to 5 connections, which is way too low for
a fast-responding server.
Issue initially found thanks to DeadZen bugging me to test cowboy with
http_load. Fix found thanks to ostinelli's misultin already having the
backlog option which was the one thing it did differently than cowboy.
Diffstat (limited to 'src/cowboy_tcp_transport.erl')
-rw-r--r-- | src/cowboy_tcp_transport.erl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl index 45c87df..49003bd 100644 --- a/src/cowboy_tcp_transport.erl +++ b/src/cowboy_tcp_transport.erl @@ -30,8 +30,9 @@ messages() -> {tcp, tcp_closed, tcp_error}. -> {ok, LSocket::inet:socket()} | {error, Reason::atom()}. listen(Opts) -> {port, Port} = lists:keyfind(port, 1, Opts), + Backlog = proplists:get_value(backlog, Opts, 128), gen_tcp:listen(Port, [binary, {active, false}, - {packet, raw}, {reuseaddr, true}]). + {backlog, Backlog}, {packet, raw}, {reuseaddr, true}]). -spec accept(LSocket::inet:socket(), Timeout::timeout()) -> {ok, Socket::inet:socket()} |