Struct ipfs_embed::PingConfig [−]
pub struct PingConfig { /* fields omitted */ }Expand description
The configuration for outbound pings.
Implementations
impl PingConfig
impl PingConfigpub fn new() -> PingConfig
pub fn new() -> PingConfigCreates a new PingConfig with the following default settings:
PingConfig::with_interval15sPingConfig::with_timeout20sPingConfig::with_max_failures1PingConfig::with_keep_alivefalse
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 with_timeout(self, d: Duration) -> PingConfig
pub fn with_timeout(self, d: Duration) -> PingConfigSets the ping timeout.
pub fn with_interval(self, d: Duration) -> PingConfig
pub fn with_interval(self, d: Duration) -> PingConfigSets the ping interval.
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfigSets the maximum number of consecutive ping failures upon which the remote peer is considered unreachable and the connection closed.
pub fn with_keep_alive(self, b: bool) -> PingConfig
pub fn with_keep_alive(self, b: bool) -> PingConfigSets 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
impl Clone for PingConfigpub fn clone(&self) -> PingConfig
pub fn clone(&self) -> PingConfigReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
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> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T[src]
impl<T> Instrument for T[src]fn instrument(self, span: Span) -> Instrumented<Self>[src]
fn instrument(self, span: Span) -> Instrumented<Self>[src]Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>[src]
fn in_current_span(self) -> Instrumented<Self>[src]impl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
type Output = TShould always be Self
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,