mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 00:31:35 +00:00
Automatically close useless connections (#816)
* Automatically close useless connections * Add a timeout before dropping the connection * Rework the timeout * Use OR to combine the outcome
This commit is contained in:
@ -193,6 +193,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn connection_keep_alive(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
// Put `Shutdown` in `self.out_state` if we don't have any substream open.
|
||||
// Otherwise, keep the state as it is but call `shutdown()` on the substream. This
|
||||
|
@ -105,6 +105,11 @@ where
|
||||
#[inline]
|
||||
fn inject_dial_upgrade_error(&mut self, _: Self::OutboundOpenInfo, _: ProtocolsHandlerUpgrErr<<Self::OutboundProtocol as OutboundUpgrade<Self::Substream>>::Error>) {}
|
||||
|
||||
#[inline]
|
||||
fn connection_keep_alive(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn shutdown(&mut self) {
|
||||
for ping in self.ping_in_substreams.iter_mut() {
|
||||
|
Reference in New Issue
Block a user