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:
Pierre Krieger
2019-01-04 12:02:39 +01:00
committed by GitHub
parent ea0f61366c
commit 7da1a860be
12 changed files with 123 additions and 8 deletions

View File

@ -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

View File

@ -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() {