Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jabber.c @ 29889:0d3151a41134
jabber: Don't ping more often than once a minute.
From rfc3920bis:
The length
of time between the use of any particular connection test is a matter
of implementation and local service policy; however, it is
RECOMMENDED that any such test be performed not more than once every
60 seconds.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 27 Feb 2010 03:49:32 +0000 |
parents | 185677f47825 |
children | 08ceb05e9fe9 7adebf6acc50 |
comparison
equal
deleted
inserted
replaced
29888:fddded5ee514 | 29889:0d3151a41134 |
---|---|
67 #include "pep.h" | 67 #include "pep.h" |
68 #include "adhoccommands.h" | 68 #include "adhoccommands.h" |
69 | 69 |
70 #include "jingle/jingle.h" | 70 #include "jingle/jingle.h" |
71 #include "jingle/rtp.h" | 71 #include "jingle/rtp.h" |
72 | |
73 #define PING_TIMEOUT 60 | |
72 | 74 |
73 GList *jabber_features = NULL; | 75 GList *jabber_features = NULL; |
74 GList *jabber_identities = NULL; | 76 GList *jabber_identities = NULL; |
75 static GSList *jabber_cmds = NULL; | 77 static GSList *jabber_cmds = NULL; |
76 | 78 |
519 return FALSE; | 521 return FALSE; |
520 } | 522 } |
521 | 523 |
522 void jabber_keepalive(PurpleConnection *gc) | 524 void jabber_keepalive(PurpleConnection *gc) |
523 { | 525 { |
524 JabberStream *js = gc->proto_data; | 526 JabberStream *js = purple_connection_get_protocol_data(gc); |
525 | 527 time_t now = time(NULL); |
526 if (js->keepalive_timeout == 0) { | 528 |
529 if (js->keepalive_timeout == 0 && (now - js->last_ping) >= PING_TIMEOUT) { | |
530 js->last_ping = now; | |
531 | |
527 jabber_keepalive_ping(js); | 532 jabber_keepalive_ping(js); |
528 js->keepalive_timeout = purple_timeout_add_seconds(120, | 533 js->keepalive_timeout = purple_timeout_add_seconds(120, |
529 (GSourceFunc)(jabber_keepalive_timeout), gc); | 534 (GSourceFunc)(jabber_keepalive_timeout), gc); |
530 } | 535 } |
531 } | 536 } |