]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Synchronize Sofia and Linux TCP keepalive timeout units
authorTravis Cross <tc@traviscross.com>
Tue, 11 Feb 2014 05:33:25 +0000 (05:33 +0000)
committerTravis Cross <tc@traviscross.com>
Tue, 11 Feb 2014 06:34:40 +0000 (06:34 +0000)
Sofia keeps the TCP keepalive timeout in milliseconds, but Linux
expects the value in seconds.  Before this change, it's unlikely the
TCP_KEEPIDLE and TCP_KEEPINTVL calls were having much effect as we
would have been passing them a huge value.

FS-6104

libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c

index 70cf64385beed16b312183a18392e1c4da2f66c9..14601f49ff3656f3f3e5533f3cee5c6dc0d2f9ac 100644 (file)
@@ -196,7 +196,11 @@ int tport_tcp_init_secondary(tport_t *self, int socket, int accepted,
 #if defined(SO_KEEPALIVE)
   setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof val);
 #endif
-  val = (int)(self->tp_params->tpp_keepalive);
+  val = (int)(self->tp_params->tpp_keepalive / 1000);
+  if (!val && (self->tp_params->tpp_keepalive > 0))
+    SU_DEBUG_1(("%s(%p): Ignoring TCP keepalive value %u (<1000)\n",
+                __func__, (void *)self,
+               self->tp_params->tpp_keepalive));
 #if defined(TCP_KEEPIDLE)
   if (val != 0 && val != UINT_MAX)
     setsockopt(socket, SOL_TCP, TCP_KEEPIDLE, (void *)&val, sizeof val);