Struct ipfs_embed::PingConfig [−]
pub struct PingConfig { /* fields omitted */ }
Expand description
The configuration for outbound pings.
Implementations
impl PingConfig
impl PingConfig
pub fn new() -> PingConfig
pub fn new() -> PingConfig
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
pub fn with_timeout(self, d: Duration) -> PingConfig
Sets the ping timeout.
pub fn with_interval(self, d: Duration) -> PingConfig
pub fn with_interval(self, d: Duration) -> PingConfig
Sets the ping interval.
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
pub fn with_max_failures(self, n: NonZeroU32) -> PingConfig
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
pub fn with_keep_alive(self, b: bool) -> PingConfig
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
impl Clone for PingConfig
pub fn clone(&self) -> PingConfig
pub fn clone(&self) -> PingConfig
Returns a copy of the value. Read more
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
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
pub fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
pub fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V