Struct libp2p::ping::PingConfig [−][src]
pub struct PingConfig { /* fields omitted */ }
Expand description
The configuration for outbound pings.
Implementations
impl PingConfig
[src]
impl PingConfig
[src]pub fn new() -> 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 with_timeout(self, d: Duration) -> PingConfig
[src]
pub fn with_timeout(self, d: Duration) -> PingConfig
[src]Sets the ping timeout.
pub fn with_interval(self, d: Duration) -> PingConfig
[src]
pub fn with_interval(self, d: Duration) -> PingConfig
[src]Sets the ping interval.
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
[src]
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_keep_alive(self, b: bool) -> PingConfig
[src]
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]
impl Clone for PingConfig
[src]pub fn clone(&self) -> PingConfig
[src]
pub fn clone(&self) -> PingConfig
[src]Returns 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> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The 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>,