Commit df5d757f authored by Raphaël Proust's avatar Raphaël Proust Committed by Romain

Shell,P2p: better error management of lwt-utils errors

parent fdf984d1
......@@ -153,8 +153,8 @@ let create conn point_info peer_info messages canceler callback
let pipe_exn_handler = function
| Lwt_pipe.Closed ->
fail P2p_errors.Connection_closed
| _ ->
assert false
| exc ->
Lwt.fail exc
(* see [Lwt_pipe.pop] *)
......
......@@ -275,7 +275,8 @@ module WriteScheduler = Scheduler (struct
let pop p =
Lwt.catch
(fun () -> Lwt_pipe.pop p >>= return)
(fun _ -> fail (Exn Lwt_pipe.Closed))
(function
| Lwt_pipe.Closed -> fail (Exn Lwt_pipe.Closed) | _ -> assert false)
type out_param = P2p_fd.t
......
......@@ -524,7 +524,8 @@ struct
| Bounded_buffer message_queue ->
close_queue message_queue
| Dropbox_buffer message_box ->
Option.iter ~f:wakeup (Lwt_dropbox.peek message_box) ;
( try Option.iter ~f:wakeup (Lwt_dropbox.peek message_box)
with Lwt_dropbox.Closed -> () ) ;
Lwt_dropbox.close message_box
let pop (type a) (w : a t) =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment