mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 01:01:34 +00:00
connection_keep_alive() now returns KeepAlive (#899)
* connection_keep_alive() now returns Option<Instant> * Use KeepAlive instead of Option<Instant>
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
use crate::protocol::{IdentifySender, IdentifyProtocolConfig};
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::{
|
||||
protocols_handler::{ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr},
|
||||
protocols_handler::{KeepAlive, ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr},
|
||||
upgrade::{DeniedUpgrade, InboundUpgrade, OutboundUpgrade}
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
@ -90,8 +90,8 @@ where
|
||||
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
|
||||
fn connection_keep_alive(&self) -> KeepAlive {
|
||||
KeepAlive::Now
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -21,7 +21,7 @@
|
||||
use crate::protocol::{RemoteInfo, IdentifyProtocolConfig};
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::{
|
||||
protocols_handler::{ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr},
|
||||
protocols_handler::{KeepAlive, ProtocolsHandler, ProtocolsHandlerEvent, ProtocolsHandlerUpgrErr},
|
||||
upgrade::{DeniedUpgrade, OutboundUpgrade}
|
||||
};
|
||||
use std::{io, marker::PhantomData, time::{Duration, Instant}};
|
||||
@ -123,8 +123,12 @@ where
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn connection_keep_alive(&self) -> bool {
|
||||
!self.first_id_happened
|
||||
fn connection_keep_alive(&self) -> KeepAlive {
|
||||
if self.first_id_happened {
|
||||
KeepAlive::Now
|
||||
} else {
|
||||
KeepAlive::Forever
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
Reference in New Issue
Block a user