Skip to content

Commit a2133ae

Browse files
authored
blocking: add tcp_keepalive option (#1100)
1 parent 3cd9c29 commit a2133ae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/blocking/client.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,18 @@ impl ClientBuilder {
409409
self.with_inner(move |inner| inner.local_address(addr))
410410
}
411411

412+
/// Set that all sockets have `SO_KEEPALIVE` set with the supplied duration.
413+
///
414+
/// If `None`, the option will not be set.
415+
///
416+
/// Default is 60 seconds.
417+
pub fn tcp_keepalive<D>(self, val: D) -> ClientBuilder
418+
where
419+
D: Into<Option<Duration>>,
420+
{
421+
self.with_inner(move |inner| inner.tcp_keepalive(val))
422+
}
423+
412424
// TLS options
413425

414426
/// Add a custom root certificate.

0 commit comments

Comments
 (0)