From 2297e643223a6579f22351063488553cb8eb6901 Mon Sep 17 00:00:00 2001 From: mefyl Date: Wed, 7 Feb 2024 15:43:43 +0100 Subject: [PATCH] cohttp-eio.Server: Don't blow up in `callback` on client read timeout. --- cohttp-eio/src/server.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cohttp-eio/src/server.ml b/cohttp-eio/src/server.ml index 364c83385..7323d0c48 100644 --- a/cohttp-eio/src/server.ml +++ b/cohttp-eio/src/server.ml @@ -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)