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

Don't flush the resp_sent message if connection is closed

Tiny optimization.
This commit is contained in:
Loïc Hoguin 2014-03-25 11:03:09 +01:00
parent 704f61c9d1
commit 0c0caa3a47

View file

@ -512,8 +512,8 @@ next_request(Req, State=#state{req_keepalive=Keepalive, timeout=Timeout},
_ -> close
end,
%% Flush the resp_sent message before moving on.
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
if HandlerRes =:= ok, Buffer =/= close ->
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
?MODULE:parse_request(Buffer,
State#state{req_keepalive=Keepalive + 1,
until=until(Timeout)}, 0);