diff --git a/lib_node_p2p/p2p_io_scheduler.ml b/lib_node_p2p/p2p_io_scheduler.ml index 93bdb6f9a..8b08312bc 100644 --- a/lib_node_p2p/p2p_io_scheduler.ml +++ b/lib_node_p2p/p2p_io_scheduler.ml @@ -9,6 +9,14 @@ (* TODO decide whether we need to preallocate buffers or not. *) +let () = + (* Otherwise some writes trigger a SIGPIPE instead of raising an + Lwt_unit exception. In the node, this is already done by + Cohttp, so this is only useful when using the P2P layer as a + stand alone library. *) + if Sys.os_type <> "Win32" then + Sys.(set_signal sigpipe Signal_ignore) + open P2p_types include Logging.Make (struct let name = "p2p.io-scheduler" end)