gory throttle avoidance. may drop

This commit is contained in:
nohar 2005-05-23 23:05:11 +00:00
parent 29cea3ef41
commit 0c375a4442
1 changed files with 12 additions and 4 deletions

View File

@ -21,6 +21,8 @@
#include "connection.h"
#include "md5.h"
#define S_CONN_DELAY (10)
extern int sighup;
static int irc_join(struct link_server *server, struct line *line);
@ -1941,12 +1943,18 @@ void irc_main(connection_t *inc, list_t *ll)
/* Compute timeouts for next reconnections and lagouts */
if (timeleft == 0) {
static int throttle_prot = S_CONN_DELAY - 1;
timeleft = 1000;
/* Lauch one reconnection at a time */
if ((link = list_remove_first(&reconnectl))) {
conn = irc_server_connect(link);
list_add_last(&connl, conn);
if (++throttle_prot == S_CONN_DELAY) {
throttle_prot = 0;
/* Lauch one reconnection at a time */
if ((link = list_remove_first(&reconnectl))) {
conn = irc_server_connect(link);
list_add_last(&connl, conn);
}
}
/* log flushs */