Skip to content

Commit

Permalink
cohttp-eio.Server: Don't blow up in callback on client read timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
mefyl committed Feb 8, 2024
1 parent 6ed9bae commit 2297e64
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cohttp-eio/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ let callback { conn_closed; handler } ((_, peer_address) as conn) input output =
m "%a: disconnected" Eio.Net.Sockaddr.pp peer_address)
in
conn_closed (conn, id)
| exception Eio.Io (Eio.Net.E (Connection_reset _), _) ->
| exception
Eio.Io
( ( Eio.Net.E (Connection_reset _)
| Eio.Exn.X _
(* To catch the backend-specific Eio_unix.Unix_error
(ETIMEDOUT, _, _), at least *) ),
_ ) ->
let () =
Logs.info (fun m ->
m "%a: connection reset" Eio.Net.Sockaddr.pp peer_address)
Expand Down

0 comments on commit 2297e64

Please sign in to comment.