Skip to content

Commit f195295

Browse files
authored
Merge pull request ocaml-multicore#787 from talex5/freebsd-close
Ignore ECONNRESET on close
2 parents f26d70d + 1766568 commit f195295

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib_eio/tests/dscheck/unix.ml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
type error = ECONNRESET
2+
3+
exception Unix_error of error * string * string
4+
15
type file_descr = [`Open | `Closed] Atomic.t
26

37
let make () = Atomic.make `Open

lib_eio/unix/rcfd.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ let get t =
9898
None
9999

100100
let close_fd fd =
101-
Eio.Private.Trace.with_span "close" (fun () -> Unix.close fd)
101+
Eio.Private.Trace.with_span "close" (fun () ->
102+
try
103+
Unix.close fd
104+
with Unix.Unix_error (ECONNRESET, _, _) ->
105+
(* For FreeBSD. See https://github.com/ocaml-multicore/eio/issues/786 *)
106+
()
107+
)
102108

103109
(* Note: we could simplify this a bit by incrementing [t.ops], as [remove] does.
104110
However, that makes dscheck too slow. *)

0 commit comments

Comments
 (0)