aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.