changeset 13991:87797e287549

[gaim-migrate @ 16565] Randomize initial reconnect delay as not to DoS servers committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 24 Jul 2006 23:57:11 +0000
parents ff4ee4ac4408
children 0567de116699
files src/gtkconn.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconn.c	Mon Jul 24 16:19:16 2006 +0000
+++ b/src/gtkconn.c	Mon Jul 24 23:57:11 2006 +0000
@@ -37,7 +37,9 @@
 #include "gtkutils.h"
 #include "util.h"
 
-#define INITIAL_RECON_DELAY 8000
+#define INITIAL_RECON_DELAY_MIN  8000
+#define INITIAL_RECON_DELAY_MAX 60000
+
 #define MAX_RECON_DELAY 600000
 
 typedef struct {
@@ -155,7 +157,7 @@
 		if (info == NULL) {
 			info = g_new0(GaimAutoRecon, 1);
 			g_hash_table_insert(hash, account, info);
-			info->delay = INITIAL_RECON_DELAY;
+			info->delay = g_random_int_range(INITIAL_RECON_DELAY_MIN, INITIAL_RECON_DELAY_MAX);
 		} else {
 			info->delay = MIN(2 * info->delay, MAX_RECON_DELAY);
 			if (info->timeout != 0)