Changed so that normal XMPP "pings" are always sent when keep alive is enabled.
authorMikael Hallendal <micke@imendio.com>
Sun, 27 Jul 2008 11:23:03 +0200
changeset 468 ca6cce100797
parent 403 055de8a68c1f
child 469 cd3e03303010
Changed so that normal XMPP "pings" are always sent when keep alive is enabled. The change to disable the periodic sending of spaces in order to ensure traffic over the socket made the LM clients disconnect periodically with specific gateways. The implementation looks correct but it might be the firewall software that is not handling it correctly. This commit reverts the behaviour to always send the spaces even if the platform supports the TCP keep alive settings.
loudmouth/lm-connection.c
--- a/loudmouth/lm-connection.c	Wed Jun 18 13:47:06 2008 +0200
+++ b/loudmouth/lm-connection.c	Sun Jul 27 11:23:03 2008 +0200
@@ -341,11 +341,15 @@
 static void
 connection_start_keep_alive (LmConnection *connection)
 {
-	/* try using TCP keepalives if possible */
-	if ((connection->keep_alive_rate > 0) &&
-		lm_socket_set_keepalive (connection->socket,
-			connection->keep_alive_rate)) {
-		return;
+        /* try using TCP keepalives if possible */
+        if ((connection->keep_alive_rate > 0) &&
+            lm_socket_set_keepalive (connection->socket,
+                                     connection->keep_alive_rate)) {
+#ifdef ONLY_TCP_KEEP_ALIVE
+                /* Many NAT firewalls seems to not handle this correctly and 
+                 * will disconnect the clients */
+                return;
+#endif /* ONLY_TCP_KEEP_ALIVE */
 	}
 
 	if (connection->keep_alive_source) {