aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/nogaim.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2008-08-06 00:07:07 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2008-08-06 00:07:07 +0100
commit280e655722c8660ec2dff9b08f82b10d5559bfd9 (patch)
tree9343c9649ab1f642956b999d1fd37dd2464f6085 /protocols/nogaim.c
parentd84e2a93feae8db909dfbe63b55066cb4e8160dc (diff)
Simple exponential backoff code. Have to add a maximum delay setting,
something like 5*5<300: 5s, multiply by 5 on each failure, but stop increasing once we hit 5m.
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r--protocols/nogaim.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 7466e93a..eb3fc2ad 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -266,6 +266,10 @@ void imcb_connected( struct im_connection *ic )
/* Also necessary when we're not away, at least for some of the
protocols. */
imc_set_away( ic, u->away );
+
+ /* Apparently we're connected successfully, so reset the
+ exponential backoff timer. */
+ ic->acc->auto_reconnect_delay = 0;
}
gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond )
@@ -330,7 +334,7 @@ void imc_logout( struct im_connection *ic, int allow_reconnect )
else if( allow_reconnect && set_getbool( &irc->set, "auto_reconnect" ) &&
set_getbool( &a->set, "auto_reconnect" ) )
{
- int delay = set_getint( &irc->set, "auto_reconnect_delay" );
+ int delay = account_reconnect_delay( a );
imcb_log( ic, "Reconnecting in %d seconds..", delay );
a->reconnect = b_timeout_add( delay * 1000, auto_reconnect, a );