pub struct TcpKeepaliveParams {
pub timeout_ms: Option<u32>,
pub count: Option<u32>,
pub interval_ms: Option<u32>,
}
Expand description
Value of --tcp-keepalive
option.
When parsed from string, it expects 0 to 3 colon-separated numbers:
- Timeout (in milliseconds)
- Number of failed pings before failing the connection
- Interval of pings (in milliseconds)
Specifying empty string or “” just requests to enable keepalives without configuring parameters.
On unsupported platforms, all or some details of keepalives may be ignored.
Example:
use tokio_listener::TcpKeepaliveParams;
let k1 : TcpKeepaliveParams = "60000:3:5000".parse().unwrap();
let k2 : TcpKeepaliveParams = "60000".parse().unwrap();
let k3 : TcpKeepaliveParams = "".parse().unwrap();
assert_eq!(k1, TcpKeepaliveParams{timeout_ms:Some(60000), count:Some(3), interval_ms:Some(5000)});
Fields§
§timeout_ms: Option<u32>
Amount of time after which TCP keepalive probes will be sent on idle connections.
count: Option<u32>
Maximum number of TCP keepalive probes that will be sent before dropping a connection.
interval_ms: Option<u32>
Time interval between TCP keepalive probes.
Implementations§
source§impl TcpKeepaliveParams
impl TcpKeepaliveParams
sourcepub fn to_socket2(&self) -> TcpKeepalive
pub fn to_socket2(&self) -> TcpKeepalive
Attempt to convert values of this struct to socket2 format.
Some fields may be ignored depending on platform.
Trait Implementations§
source§impl Clone for TcpKeepaliveParams
impl Clone for TcpKeepaliveParams
source§fn clone(&self) -> TcpKeepaliveParams
fn clone(&self) -> TcpKeepaliveParams
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TcpKeepaliveParams
impl Debug for TcpKeepaliveParams
source§impl Default for TcpKeepaliveParams
impl Default for TcpKeepaliveParams
source§fn default() -> TcpKeepaliveParams
fn default() -> TcpKeepaliveParams
Returns the “default value” for a type. Read more
source§impl Display for TcpKeepaliveParams
impl Display for TcpKeepaliveParams
source§impl FromStr for TcpKeepaliveParams
impl FromStr for TcpKeepaliveParams
source§impl PartialEq for TcpKeepaliveParams
impl PartialEq for TcpKeepaliveParams
impl Copy for TcpKeepaliveParams
impl Eq for TcpKeepaliveParams
impl StructuralPartialEq for TcpKeepaliveParams
Auto Trait Implementations§
impl Freeze for TcpKeepaliveParams
impl RefUnwindSafe for TcpKeepaliveParams
impl Send for TcpKeepaliveParams
impl Sync for TcpKeepaliveParams
impl Unpin for TcpKeepaliveParams
impl UnwindSafe for TcpKeepaliveParams
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request