From: Matt Corallo Date: Tue, 3 Jul 2018 00:07:37 +0000 (-0400) Subject: Add warning about aut-close()-fd-races for peer_handler impls X-Git-Tag: v0.0.12~395^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=e98e1e2fdca15edab9a5e0ef9b49c841904af445;p=rust-lightning Add warning about aut-close()-fd-races for peer_handler impls --- diff --git a/src/ln/peer_handler.rs b/src/ln/peer_handler.rs index 86e255362..812bade68 100644 --- a/src/ln/peer_handler.rs +++ b/src/ln/peer_handler.rs @@ -21,7 +21,9 @@ pub struct MessageHandler { /// implement Hash to meet the PeerManager API. /// For efficiency, Clone should be relatively cheap for this type. /// You probably want to just extend an int and put a file descriptor in a struct and implement -/// send_data. +/// send_data. Note that if you are using a higher-level net library that may close() itself, be +/// careful to ensure you don't have races whereby you might register a new connection with an fd +/// the same as a yet-to-be-disconnect_event()-ed. pub trait SocketDescriptor : cmp::Eq + hash::Hash + Clone { /// Attempts to send some data from the given Vec starting at the given offset to the peer. /// Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.