Struct TcpKeepalive
pub struct TcpKeepalive {
pub(crate) time: Option<Duration>,
pub(crate) interval: Option<Duration>,
pub(crate) retries: Option<u32>,
}
Expand description
Configures a socket’s TCP keepalive parameters.
See [Socket::set_tcp_keepalive
].
Fields§
§time: Option<Duration>
§interval: Option<Duration>
§retries: Option<u32>
Implementations§
§impl TcpKeepalive
impl TcpKeepalive
pub const fn new() -> TcpKeepalive
pub const fn new() -> TcpKeepalive
Returns a new, empty set of TCP keepalive parameters.
pub const fn with_time(self, time: Duration) -> TcpKeepalive
pub const fn with_time(self, time: Duration) -> TcpKeepalive
Set the amount of time after which TCP keepalive probes will be sent on idle connections.
This will set TCP_KEEPALIVE
on macOS and iOS, and
TCP_KEEPIDLE
on all other Unix operating systems, except
OpenBSD and Haiku which don’t support any way to set this
option. On Windows, this sets the value of the tcp_keepalive
struct’s keepalivetime
field.
Some platforms specify this value in seconds, so sub-second specifications may be omitted.
pub const fn with_interval(self, interval: Duration) -> TcpKeepalive
pub const fn with_interval(self, interval: Duration) -> TcpKeepalive
Set the value of the TCP_KEEPINTVL
option. On Windows, this sets the
value of the tcp_keepalive
struct’s keepaliveinterval
field.
Sets the time interval between TCP keepalive probes.
Some platforms specify this value in seconds, so sub-second specifications may be omitted.
pub const fn with_retries(self, retries: u32) -> TcpKeepalive
pub const fn with_retries(self, retries: u32) -> TcpKeepalive
Set the value of the TCP_KEEPCNT
option.
Set the maximum number of TCP keepalive probes that will be sent before dropping a connection, if TCP keepalive is enabled on this socket.
Trait Implementations§
§impl Clone for TcpKeepalive
impl Clone for TcpKeepalive
§fn clone(&self) -> TcpKeepalive
fn clone(&self) -> TcpKeepalive
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for TcpKeepalive
impl RefUnwindSafe for TcpKeepalive
impl Send for TcpKeepalive
impl Sync for TcpKeepalive
impl Unpin for TcpKeepalive
impl UnwindSafe for TcpKeepalive
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
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)
clone_to_uninit
)§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§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>
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.