From a2133aec3b313bb370c0cf88173de33ce7cba465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 7 Dec 2020 16:56:56 +0100 Subject: [PATCH] blocking: add tcp_keepalive option (#1100) --- src/blocking/client.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/blocking/client.rs b/src/blocking/client.rs index 3684483..60f6992 100644 --- a/src/blocking/client.rs +++ b/src/blocking/client.rs @@ -409,6 +409,18 @@ impl ClientBuilder { self.with_inner(move |inner| inner.local_address(addr)) } + /// Set that all sockets have `SO_KEEPALIVE` set with the supplied duration. + /// + /// If `None`, the option will not be set. + /// + /// Default is 60 seconds. + pub fn tcp_keepalive(self, val: D) -> ClientBuilder + where + D: Into>, + { + self.with_inner(move |inner| inner.tcp_keepalive(val)) + } + // TLS options /// Add a custom root certificate.