Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lwt-unix/gluten_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ module Io :
match Lwt_unix.state socket with
| Closed -> Lwt.return_unit
| _ ->
Lwt.catch
Lwt.finalize
(fun () ->
Lwt_unix.shutdown socket SHUTDOWN_ALL;
Lwt.catch
(fun () ->
Lwt_unix.shutdown socket SHUTDOWN_ALL;
Lwt.return_unit)
(function
| Unix.Unix_error (Unix.ENOTCONN, _, _) -> Lwt.return_unit
| exn -> Lwt.reraise exn))
(fun () ->
Lwt_unix.close socket)
(fun _exn -> Lwt.return_unit)


let read socket bigstring ~off ~len =
Lwt.catch
Expand Down