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

Handle socket errors in HTTP/1.1 and HTTP/2

Doing so will let us notice when the connection is gone instead
of waiting for timeouts, at least in the cases where the remote
socket was closed properly. Timeouts are still needed in case
of TCP half-open problems.

This change means that the order of stream handler commands is
more important than before because socket errors may occur
during the processing of commands.
This commit is contained in:
Loïc Hoguin 2023-12-12 12:05:54 +01:00
parent 3f5f326b73
commit efb681d749
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
5 changed files with 197 additions and 127 deletions

View file

@ -410,7 +410,7 @@ shutdown_timeout_on_socket_close(Config) ->
receive {Self, Pid, terminate, _, _, _} -> ok after 1000 -> error(timeout) end,
%% We should NOT receive a DOWN message immediately.
receive {'DOWN', MRef, process, Spawn, killed} -> error(killed) after 1500 -> ok end,
%% We should received it now.
%% We should receive it now.
receive {'DOWN', MRef, process, Spawn, killed} -> ok after 1000 -> error(timeout) end,
ok.