0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Increase the default backlog from 128 to 1024.

Improves reliability under heavy load.
This commit is contained in:
Loïc Hoguin 2011-05-09 20:37:12 +02:00
parent 420f5baf98
commit b3d3045cae
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ messages() -> {ssl, ssl_closed, ssl_error}.
-> {ok, LSocket::ssl:sslsocket()} | {error, Reason::atom()}. -> {ok, LSocket::ssl:sslsocket()} | {error, Reason::atom()}.
listen(Opts) -> listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts), {port, Port} = lists:keyfind(port, 1, Opts),
Backlog = proplists:get_value(backlog, Opts, 128), Backlog = proplists:get_value(backlog, Opts, 1024),
{certfile, CertFile} = lists:keyfind(certfile, 1, Opts), {certfile, CertFile} = lists:keyfind(certfile, 1, Opts),
{keyfile, KeyFile} = lists:keyfind(keyfile, 1, Opts), {keyfile, KeyFile} = lists:keyfind(keyfile, 1, Opts),
{password, Password} = lists:keyfind(password, 1, Opts), {password, Password} = lists:keyfind(password, 1, Opts),

View file

@ -30,7 +30,7 @@ messages() -> {tcp, tcp_closed, tcp_error}.
-> {ok, LSocket::inet:socket()} | {error, Reason::atom()}. -> {ok, LSocket::inet:socket()} | {error, Reason::atom()}.
listen(Opts) -> listen(Opts) ->
{port, Port} = lists:keyfind(port, 1, Opts), {port, Port} = lists:keyfind(port, 1, Opts),
Backlog = proplists:get_value(backlog, Opts, 128), Backlog = proplists:get_value(backlog, Opts, 1024),
gen_tcp:listen(Port, [binary, {active, false}, gen_tcp:listen(Port, [binary, {active, false},
{backlog, Backlog}, {packet, raw}, {reuseaddr, true}]). {backlog, Backlog}, {packet, raw}, {reuseaddr, true}]).