Changed so that normal XMPP "pings" are always sent when keep alive is enabled.
authorMikael Hallendal <micke@imendio.com>
Fri, 20 Jun 2008 16:44:42 +0200
changeset 413 4f24f7775c47
parent 412 d355b566f141
child 414 76bb882301ad
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	Fri Jun 20 16:42:26 2008 +0200
+++ b/loudmouth/lm-connection.c	Fri Jun 20 16:44:42 2008 +0200
@@ -358,11 +358,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) {