mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 15:16:22 +00:00
Extend autoping timer on each stanza we receive.
Sometimes the server is too busy sending other stanzas or our connection is saturated because of something else, so the pong arrives too late. Prevent the autoping disconnect event by extending the timeout each time a stanza is received. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
@@ -176,8 +176,7 @@ static int
|
||||
_iq_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||
{
|
||||
log_debug("iq stanza handler fired");
|
||||
|
||||
iq_autoping_timer_cancel(); // reset the autoping timer
|
||||
autoping_timer_extend();
|
||||
|
||||
char* text;
|
||||
size_t text_size;
|
||||
@@ -1391,6 +1390,13 @@ _autoping_timed_send(xmpp_conn_t* const conn, void* const userdata)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
autoping_timer_extend(void)
|
||||
{
|
||||
if (autoping_time)
|
||||
g_timer_start(autoping_time);
|
||||
}
|
||||
|
||||
static int
|
||||
_auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
{
|
||||
|
||||
@@ -153,6 +153,7 @@ static int
|
||||
_message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||
{
|
||||
log_debug("Message stanza handler fired");
|
||||
autoping_timer_extend();
|
||||
|
||||
if (_handled_by_plugin(stanza)) {
|
||||
return 1;
|
||||
|
||||
@@ -347,6 +347,7 @@ static int
|
||||
_presence_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const userdata)
|
||||
{
|
||||
log_debug("Presence stanza handler fired");
|
||||
autoping_timer_extend();
|
||||
|
||||
char* text = NULL;
|
||||
size_t text_size;
|
||||
|
||||
@@ -269,6 +269,8 @@ void iq_mam_request_older(ProfChatWin* win);
|
||||
void iq_register_change_password(const char* const user, const char* const password);
|
||||
void iq_muc_register_nick(const char* const roomjid);
|
||||
|
||||
void autoping_timer_extend(void);
|
||||
|
||||
EntityCapabilities* caps_lookup(const char* const jid);
|
||||
void caps_close(void);
|
||||
void caps_destroy(EntityCapabilities* caps);
|
||||
|
||||
Reference in New Issue
Block a user