Skip to content

Commit

Permalink
On FreeBSD, close can fail with ECONNRESET
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Sep 25, 2024
1 parent 2473de3 commit a242ccd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion unix/unix_flow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ let close t =
t.closed <- true;
opt_cancel t.current_read;
opt_cancel t.current_write;
Lwt_unix.close t.fd
Lwt.catch
(fun () -> Lwt_unix.close t.fd)
(function
| Unix.Unix_error (Unix.ECONNRESET, _, _) -> Lwt.return_unit (* FreeBSD *)
| ex -> raise ex
)
)

let pp_error f = function
Expand Down

0 comments on commit a242ccd

Please sign in to comment.