aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-01-31 21:11:42 +0100
committerLoïc Hoguin <[email protected]>2012-01-31 21:11:42 +0100
commit2c0c85cd2ff2022b77a73e2921b5967a2053e3de (patch)
tree74476937f5205d10f10792121111dfb4e97d6a41
parent0c3cf802b429258e2a6ff924156c8d330de5c7e1 (diff)
parent697170b4968373d70193c4719ef2c4d8bf810ceb (diff)
downloadcowboy-2c0c85cd2ff2022b77a73e2921b5967a2053e3de.tar.gz
cowboy-2c0c85cd2ff2022b77a73e2921b5967a2053e3de.tar.bz2
cowboy-2c0c85cd2ff2022b77a73e2921b5967a2053e3de.zip
Merge branch 'remove-queue-len-call' of https://github.com/puzza007/cowboy
-rw-r--r--src/cowboy_listener.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cowboy_listener.erl b/src/cowboy_listener.erl
index b12e059..de81cbe 100644
--- a/src/cowboy_listener.erl
+++ b/src/cowboy_listener.erl
@@ -202,11 +202,10 @@ remove_pid(Pid, Pools, ReqsTable, Queue) ->
{Pool, NbConns} = lists:keyfind(Pool, 1, Pools),
Pools2 = [{Pool, NbConns - 1}|lists:keydelete(Pool, 1, Pools)],
ets:delete(ReqsTable, Pid),
- case queue:len(Queue) of
- 0 ->
- {Pools2, Queue};
- _ ->
- {{value, Client}, Queue2} = queue:out(Queue),
+ case queue:out(Queue) of
+ {{value, Client}, Queue2} ->
gen_server:reply(Client, ok),
- {Pools2, Queue2}
+ {Pools2, Queue2};
+ _ ->
+ {Pools2, Queue}
end.