[Spice-devel] [spice-server 3/3] Set TCP_KEEPINTVL when enabling TCP keepalive

Christophe Fergeau cfergeau at redhat.com
Thu Mar 10 15:57:38 UTC 2016


Otherwise we are only changing the timeout before the first keepalive
probe is sent.
---
 server/reds.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/reds.c b/server/reds.c
index b1e1139..3cc6d48 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2309,6 +2309,14 @@ static bool reds_init_keepalive(int socket)
         }
     }
 
+    if (setsockopt(socket, SOL_TCP, TCP_KEEPINTVL,
+                   &keepalive_timeout, sizeof(keepalive_timeout)) == -1) {
+        if (errno != ENOTSUP) {
+            spice_printerr("setsockopt for keepalive interval failed, %s", strerror(errno));
+            return false;
+        }
+    }
+
     return true;
 }
 
-- 
2.5.0



More information about the Spice-devel mailing list