[−][src]Struct libp2prs_swarm::ping::PingConfig
The configuration for outbound pings.
Implementations
impl PingConfig
[src]
pub fn new() -> Self
[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(mut self: Self, d: Duration) -> Self
[src]
Sets the ping timeout.
pub fn with_interval(mut self: Self, d: Duration) -> Self
[src]
Sets the ping interval.
pub fn with_max_failures(mut self: Self, n: NonZeroU32) -> Self
[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(mut self: Self, b: bool) -> Self
[src]
Sets the unsolicited Ping flag.
pub fn with_keep_alive(mut self: Self, b: bool) -> Self
[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]
Auto Trait Implementations
impl RefUnwindSafe for PingConfig
[src]
impl Send for PingConfig
[src]
impl Sync for PingConfig
[src]
impl Unpin for PingConfig
[src]
impl UnwindSafe for PingConfig
[src]
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
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
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>,