Skip to content

Commit a2fce3b

Browse files
committed
Further clean up some comments wrt the peer socket handling API
1 parent 2be0810 commit a2fce3b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ pub struct MessageHandler<CM: Deref> where CM::Target: msgs::ChannelMessageHandl
4747
/// For efficiency, Clone should be relatively cheap for this type.
4848
///
4949
/// You probably want to just extend an int and put a file descriptor in a struct and implement
50-
/// send_data. Note that if you are using a higher-level net library that may close() itself, be
51-
/// careful to ensure you don't have races whereby you might register a new connection with an fd
52-
/// the same as a yet-to-be-socket_disconnected()-ed.
50+
/// send_data. Note that if you are using a higher-level net library that may call close() itself,
51+
/// be careful to ensure you don't have races whereby you might register a new connection with an
52+
/// fd which is the same as a previous one which has yet to be removed via
53+
/// PeerManager::socket_disconnected().
5354
pub trait SocketDescriptor : cmp::Eq + hash::Hash + Clone {
5455
/// Attempts to send some data from the given slice to the peer.
5556
///
5657
/// Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
57-
/// Note that in the disconnected case, a socket_disconnected must still fire and further write
58+
/// Note that in the disconnected case, socket_disconnected must still fire and further write
5859
/// attempts may occur until that time.
5960
///
6061
/// If the returned size is smaller than data.len(), a write_available event must
@@ -69,16 +70,16 @@ pub trait SocketDescriptor : cmp::Eq + hash::Hash + Clone {
6970
/// Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7071
/// more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7172
/// this descriptor. No socket_disconnected call should be generated as a result of this call,
72-
/// though obviously races may occur whereby disconnect_socket is called after a call to
73-
/// socket_disconnected but prior to that event completing.
73+
/// though races may occur whereby disconnect_socket is called after a call to
74+
/// socket_disconnected but prior to socket_disconnected returning.
7475
fn disconnect_socket(&mut self);
7576
}
7677

7778
/// Error for PeerManager errors. If you get one of these, you must disconnect the socket and
7879
/// generate no further read_event/write_buffer_space_avail calls for the descriptor, only
7980
/// triggering a single socket_disconnected call (unless it was provided in response to a
80-
/// new_*_connection event, in which case no such socket_disconnected() must be generated and the
81-
/// socket be silently disconencted).
81+
/// new_*_connection event, in which case no such socket_disconnected() must be called and the
82+
/// socket silently disconencted).
8283
pub struct PeerHandleError {
8384
/// Used to indicate that we probably can't make any future connections to this peer, implying
8485
/// we should go ahead and force-close any channels we have with it.

0 commit comments

Comments
 (0)