pidgin: a4c67ebd: Only allow one keepalive_timeout at a ti...

evands at pidgin.im evands at pidgin.im
Tue Mar 11 19:00:49 EDT 2008


-----------------------------------------------------------------
Revision: a4c67ebda7af92f03a3da8f978c16b2a4e6d0891
Ancestor: 2df22d7ed44f0ccc912fc22ea2e0389c0e445b6f
Author: evands at pidgin.im
Date: 2008-03-11T22:58:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a4c67ebda7af92f03a3da8f978c16b2a4e6d0891

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

Only allow one keepalive_timeout at a time. This prevents us from starting a
second one and therefore losing track of the first when the server isn't
responding within the 120 second timeout interval. Refs #4814; really shouldn't
fix it, but it might.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	423eb23edf4b9fe1ed4d05667e5740d8fa8d68aa
+++ libpurple/protocols/jabber/jabber.c	98c9e290dd0f5160dd5a918c98e5aafe9591ca82
@@ -406,14 +406,17 @@ void jabber_keepalive(PurpleConnection *
 void jabber_keepalive(PurpleConnection *gc)
 {
 	JabberStream *js = gc->proto_data;
-	JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
 
-	xmlnode *ping = xmlnode_new_child(iq->node, "ping");
-	xmlnode_set_namespace(ping, "urn:xmpp:ping");
-
-	js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc);
-	jabber_iq_set_callback(iq, jabber_pong_cb, GINT_TO_POINTER(js->keepalive_timeout));
-	jabber_iq_send(iq);
+	if (js->keepalive_timeout == -1) {
+		JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
+		
+		xmlnode *ping = xmlnode_new_child(iq->node, "ping");
+		xmlnode_set_namespace(ping, "urn:xmpp:ping");
+		
+		js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc);
+		jabber_iq_set_callback(iq, jabber_pong_cb, GINT_TO_POINTER(js->keepalive_timeout));
+		jabber_iq_send(iq);
+	}
 }
 
 static void


More information about the Commits mailing list