mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-04 04:01:33 +00:00
swarm/src/protocols_handler: Document alternative to Event::Close (#2470)
There are 3 ways to close a connection: 1. `ProtocolsHandlerEvent::Close` 2. `KeepAlive::No` via `ProtocolsHandler::connection_keep_alive` 3. `NetworkBehaviourAction::CloseConnection` This commit references (2) as an alternative to (1) in the documentation of (1).
This commit is contained in:
@ -318,6 +318,13 @@ pub enum ProtocolsHandlerEvent<TConnectionUpgrade, TOutboundOpenInfo, TCustom, T
|
||||
},
|
||||
|
||||
/// Close the connection for the given reason.
|
||||
///
|
||||
/// Note this will affect all [`ProtocolsHandler`]s handling this
|
||||
/// connection, in other words it will close the connection for all
|
||||
/// [`ProtocolsHandler`]s. To signal that one has no more need for the
|
||||
/// connection, while allowing other [`ProtocolsHandler`]s to continue using
|
||||
/// the connection, return [`KeepAlive::No`] in
|
||||
/// [`ProtocolsHandler::connection_keep_alive`].
|
||||
Close(TErr),
|
||||
|
||||
/// Other event.
|
||||
|
Reference in New Issue
Block a user