pidgin: 408265dc: The XMPP keepalive timeout handle needs ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jun 7 13:05:38 EDT 2009


-----------------------------------------------------------------
Revision: 408265dcba8c86bb2b2eea880a0b491122c64ee8
Ancestor: 100733bff03a2e5b1bbb969d9053e2b8ab366cfc
Author: darkrain42 at pidgin.im
Date: 2009-06-07T17:02:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/408265dcba8c86bb2b2eea880a0b491122c64ee8

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

ChangeLog: 

The XMPP keepalive timeout handle needs to be a guint.

This probably isn't the issue of Adium#12351, but is more correct.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	7ab0c4612b558e02fac08c32046ca19325f12cd1
+++ libpurple/protocols/jabber/jabber.c	1149e49ab4217c784cf07e36455ae72d89a28aac
@@ -474,7 +474,7 @@ static gboolean jabber_keepalive_timeout
 	JabberStream *js = gc->proto_data;
 	purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 					_("Ping timeout"));
-	js->keepalive_timeout = -1;
+	js->keepalive_timeout = 0;
 	return FALSE;
 }
 
@@ -482,7 +482,7 @@ void jabber_keepalive(PurpleConnection *
 {
 	JabberStream *js = gc->proto_data;
 
-	if (js->keepalive_timeout == -1) {
+	if (js->keepalive_timeout == 0) {
 		jabber_keepalive_ping(js);
 		js->keepalive_timeout = purple_timeout_add_seconds(120,
 				(GSourceFunc)(jabber_keepalive_timeout), gc);
@@ -778,7 +778,7 @@ jabber_login(PurpleAccount *account)
 	js->next_id = g_random_int();
 	js->write_buffer = purple_circ_buffer_new(512);
 	js->old_length = 0;
-	js->keepalive_timeout = -1;
+	js->keepalive_timeout = 0;
 	/* Set the default protocol version to 1.0. Overridden in parser.c. */
 	js->protocol_version = JABBER_PROTO_1_0;
 	js->sessions = NULL;
@@ -1295,7 +1295,7 @@ void jabber_register_account(PurpleAccou
 	js->user = jabber_id_new(purple_account_get_username(account));
 	js->next_id = g_random_int();
 	js->old_length = 0;
-	js->keepalive_timeout = -1;
+	js->keepalive_timeout = 0;
 
 	if(!js->user) {
 		purple_connection_error_reason (gc,
@@ -1548,7 +1548,7 @@ void jabber_close(PurpleConnection *gc)
 	g_free(js->old_track);
 	g_free(js->expected_rspauth);
 
-	if (js->keepalive_timeout != -1)
+	if (js->keepalive_timeout != 0)
 		purple_timeout_remove(js->keepalive_timeout);
 
 	g_free(js->srv_rec);
============================================================
--- libpurple/protocols/jabber/jabber.h	68f4a86b04521eecd98908f31c949aaae27511e7
+++ libpurple/protocols/jabber/jabber.h	5db20d2606f84a6e2d74851aab60ee184c4f497b
@@ -245,7 +245,7 @@ struct _JabberStream
 	char *certificate_CN;
 
 	/* A purple timeout tag for the keepalive */
-	int keepalive_timeout;
+	guint keepalive_timeout;
 
 	PurpleSrvResponse *srv_rec;
 	guint srv_rec_idx;
============================================================
--- libpurple/protocols/jabber/ping.c	6633b410f413b9f686cab70d6e83e806d8074f98
+++ libpurple/protocols/jabber/ping.c	2dbe5297db6ce1d5488090095738fbd48ac86fb9
@@ -32,9 +32,9 @@ static void jabber_keepalive_pong_cb(Jab
                                      JabberIqType type, const char *id,
                                      xmlnode *packet, gpointer data)
 {
-	if (js->keepalive_timeout >= 0) {
+	if (js->keepalive_timeout != 0) {
 		purple_timeout_remove(js->keepalive_timeout);
-		js->keepalive_timeout = -1;
+		js->keepalive_timeout = 0;
 	}
 }
 


More information about the Commits mailing list