comparison libpurple/protocols/jabber/jabber.c @ 22448:8ec6ac1b9e26

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.
author Evan Schoenberg <evan.s@dreskin.net>
date Tue, 11 Mar 2008 22:58:36 +0000
parents fb54dacfea62
children 9a84976c8e76 efaecb71baad 9f67f9a58564
comparison
equal deleted inserted replaced
22439:b53bacc6eb6e 22448:8ec6ac1b9e26
404 } 404 }
405 405
406 void jabber_keepalive(PurpleConnection *gc) 406 void jabber_keepalive(PurpleConnection *gc)
407 { 407 {
408 JabberStream *js = gc->proto_data; 408 JabberStream *js = gc->proto_data;
409 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); 409
410 410 if (js->keepalive_timeout == -1) {
411 xmlnode *ping = xmlnode_new_child(iq->node, "ping"); 411 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
412 xmlnode_set_namespace(ping, "urn:xmpp:ping"); 412
413 413 xmlnode *ping = xmlnode_new_child(iq->node, "ping");
414 js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc); 414 xmlnode_set_namespace(ping, "urn:xmpp:ping");
415 jabber_iq_set_callback(iq, jabber_pong_cb, GINT_TO_POINTER(js->keepalive_timeout)); 415
416 jabber_iq_send(iq); 416 js->keepalive_timeout = purple_timeout_add_seconds(120, (GSourceFunc)(jabber_pong_timeout), gc);
417 jabber_iq_set_callback(iq, jabber_pong_cb, GINT_TO_POINTER(js->keepalive_timeout));
418 jabber_iq_send(iq);
419 }
417 } 420 }
418 421
419 static void 422 static void
420 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, 423 jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc,
421 PurpleInputCondition cond) 424 PurpleInputCondition cond)