We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 94fa9f6 + b3f805f commit c246df2Copy full SHA for c246df2
lib/xs_transport_lwt_unix_client.ml
@@ -34,7 +34,12 @@ let create () =
34
| Lwt_unix.S_SOCK ->
35
let sockaddr = Lwt_unix.ADDR_UNIX(path) in
36
let fd = Lwt_unix.socket Lwt_unix.PF_UNIX Lwt_unix.SOCK_STREAM 0 in
37
- Lwt_unix.connect fd sockaddr >>= fun () ->
+ Lwt.catch (fun () ->
38
+ Lwt_unix.connect fd sockaddr
39
+ ) (fun e ->
40
+ Lwt_unix.close fd >>= fun () -> Lwt.fail e
41
+ )
42
+ >>= fun () ->
43
return fd
44
| _ ->
45
let fd = Unix.openfile path [ Lwt_unix.O_RDWR ] 0o0 in
0 commit comments