@@ -178,16 +178,12 @@ pub struct MessageHandler<CM: Deref, RM: Deref> where
178
178
///
179
179
/// For efficiency, Clone should be relatively cheap for this type.
180
180
///
181
- /// If applicable in your language, you probably want to just extend an int and put a file
182
- /// descriptor in a struct and implement this trait on it. Note, of course, that if you do so and
183
- /// have multiple threads interacting with the [`PeerManager`], you must not call `close()` on the
184
- /// file descriptor until all threads are guaranteed to not call any [`PeerManager`] functions with
185
- /// the same descriptor. Otherwise, file descriptor re-use could imply that you call a
186
- /// [`PeerManager`] function with a file descriptor representing a different connection.
187
- ///
188
- /// Note that if you are using a higher-level net library that may call close() itself when you
189
- /// close a socket, be careful to ensure you don't directly use the file descriptor for your [`Eq`]
190
- /// and [`Hash`] implementations.
181
+ /// Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
182
+ /// has been disconnected, the [`PeerManager`] informed of the disconnection (either by it having
183
+ /// triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no further
184
+ /// calls to the [`PeerManager`] related to the original socket occur. This allows you to use a
185
+ /// file descriptor for your SocketDescriptor directly, however for simplicity you may wish to
186
+ /// simply use another value which is guaranteed to be globally unique instead.
191
187
pub trait SocketDescriptor : cmp:: Eq + hash:: Hash + Clone {
192
188
/// Attempts to send some data from the given slice to the peer.
193
189
///
0 commit comments