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