Created
April 17, 2012 20:07
-
-
Save lpgauth/2408674 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cowboy_acceptor.erl b/src/cowboy_acceptor.erl | |
index 4cb9fa7..705c5ed 100644 | |
--- a/src/cowboy_acceptor.erl | |
+++ b/src/cowboy_acceptor.erl | |
@@ -38,10 +38,7 @@ acceptor(LSocket, Transport, Protocol, Opts, MaxConns, ListenerPid, ReqsSup) -> | |
{ok, Pid} = supervisor:start_child(ReqsSup, | |
[ListenerPid, CSocket, Transport, Protocol, Opts]), | |
Transport:controlling_process(CSocket, Pid), | |
- {ok, NbConns} = cowboy_listener:add_connection(ListenerPid, | |
- default, Pid), | |
- Pid ! {shoot, ListenerPid}, | |
- limit_reqs(ListenerPid, NbConns, MaxConns); | |
+ Pid ! {shoot, ListenerPid}; | |
{error, timeout} -> | |
ignore; | |
{error, _Reason} -> | |
@@ -51,9 +48,3 @@ acceptor(LSocket, Transport, Protocol, Opts, MaxConns, ListenerPid, ReqsSup) -> | |
end, | |
?MODULE:acceptor(LSocket, Transport, Protocol, Opts, | |
MaxConns, ListenerPid, ReqsSup). | |
- | |
--spec limit_reqs(pid(), non_neg_integer(), non_neg_integer()) -> ok. | |
-limit_reqs(_ListenerPid, NbConns, MaxConns) when NbConns =< MaxConns -> | |
- ok; | |
-limit_reqs(ListenerPid, _NbConns, MaxConns) -> | |
- cowboy_listener:wait(ListenerPid, default, MaxConns). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment