Struct libp2p_rs::swarm::ping::PingConfig [−][src]
pub struct PingConfig { /* fields omitted */ }
The configuration for outbound pings.
Implementations
impl PingConfig
[src]
pub fn new() -> PingConfig
[src]
Creates a new PingConfig
with the following default settings:
PingConfig::with_interval
15sPingConfig::with_timeout
20sPingConfig::with_max_failures
1PingConfig::with_keep_alive
false
These settings have the following effect:
- A ping is sent every 15 seconds on a healthy connection.
- Every ping sent must yield a response within 20 seconds in order to be successful.
- A single ping failure is sufficient for the connection to be subject to being closed.
- The connection may be closed at any time as far as the ping protocol is concerned, i.e. the ping protocol itself does not keep the connection alive.
pub fn timeout(&self) -> Duration
[src]
Gets the ping timeout.
pub fn interval(&self) -> Duration
[src]
Sets the ping interval.
pub fn max_failures(&self) -> u32
[src]
Sets the maximum number of consecutive ping failures upon which the remote peer is considered unreachable and the connection closed.
pub fn unsolicited(&self) -> bool
[src]
Gets the unsolicited Ping flag.
pub fn with_timeout(self, d: Duration) -> PingConfig
[src]
Sets the ping timeout.
pub fn with_interval(self, d: Duration) -> PingConfig
[src]
Sets the ping interval.
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
[src]
Sets the maximum number of consecutive ping failures upon which the remote peer is considered unreachable and the connection closed.
pub fn with_unsolicited(self, b: bool) -> PingConfig
[src]
Sets the unsolicited Ping flag.
pub fn with_keep_alive(self, b: bool) -> PingConfig
[src]
Sets whether the ping protocol itself should keep the connection alive, apart from the maximum allowed failures.
By default, the ping protocol itself allows the connection to be closed at any time, i.e. in the absence of ping failures the connection lifetime is determined by other protocol handlers.
If the maximum number of allowed ping failures is reached, the
connection is always terminated as a result of [ProtocolsHandler::poll
]
returning an error, regardless of the keep-alive setting.
Trait Implementations
impl Clone for PingConfig
[src]
pub fn clone(&self) -> PingConfig
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PingConfig
[src]
impl Default for PingConfig
[src]
pub fn default() -> PingConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for PingConfig
impl Send for PingConfig
impl Sync for PingConfig
impl Unpin for PingConfig
impl UnwindSafe for PingConfig
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,