Skip to content

Commit e98e1e2

Browse files
committed
Add warning about aut-close()-fd-races for peer_handler impls
1 parent a426062 commit e98e1e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ln/peer_handler.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ pub struct MessageHandler {
2121
/// implement Hash to meet the PeerManager API.
2222
/// For efficiency, Clone should be relatively cheap for this type.
2323
/// You probably want to just extend an int and put a file descriptor in a struct and implement
24-
/// send_data.
24+
/// send_data. Note that if you are using a higher-level net library that may close() itself, be
25+
/// careful to ensure you don't have races whereby you might register a new connection with an fd
26+
/// the same as a yet-to-be-disconnect_event()-ed.
2527
pub trait SocketDescriptor : cmp::Eq + hash::Hash + Clone {
2628
/// Attempts to send some data from the given Vec starting at the given offset to the peer.
2729
/// Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.

0 commit comments

Comments
 (0)