Skip to content

Commit fe40d15

Browse files
committed
Catch Miou.Cancelled exception when we try to read on tcp/tls (which means that the connection become useless)
1 parent 73b1c4c commit fe40d15

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/mnet_dns.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ module Transport = struct
276276
let rec read_from_tcp t ke buf flow =
277277
match Mnet.TCP.read flow buf with
278278
| 0 -> Log.debug (fun m -> m "TCP connection closed by peer")
279+
| exception Miou.Cancelled -> Log.debug (fun m -> m "TCP connection closed by us (useless connection)")
279280
| exception exn ->
280281
Log.err (fun m ->
281282
m "TCP connection failed with: %s" (Printexc.to_string exn))
@@ -288,6 +289,7 @@ module Transport = struct
288289
let rec read_from_tls t ke buf flow =
289290
match Mnet_tls.read flow buf with
290291
| 0 -> Log.debug (fun m -> m "TLS connection closed by peer")
292+
| exception Miou.Cancelled -> Log.debug (fun m -> m "TLS connection closed by us (useless connection)")
291293
| exception exn ->
292294
Log.err (fun m ->
293295
m "TLS connection failed with: %s" (Printexc.to_string exn))

0 commit comments

Comments
 (0)