1
0
forked from bip/bip

use connect timestamp instead of reconnect

This commit is contained in:
nohar 2005-05-27 10:25:31 +00:00
parent 04dc4526cc
commit d9a149b4dd
2 changed files with 4 additions and 4 deletions

View File

@ -1647,8 +1647,8 @@ static void irc_close(struct link_any *l)
server_next(LINK(is)); server_next(LINK(is));
server_cleanup(is); server_cleanup(is);
if (LINK(is)->last_reconnection && if (LINK(is)->last_connection &&
time(NULL) - LINK(is)->last_reconnection time(NULL) - LINK(is)->last_connection
< CONN_INTERVAL) < CONN_INTERVAL)
timer = RECONN_TIMER; timer = RECONN_TIMER;
mylog(LOG_ERROR, "%s dead, reconnecting in %d seconds", mylog(LOG_ERROR, "%s dead, reconnecting in %d seconds",
@ -1955,6 +1955,7 @@ void irc_main(connection_t *inc, list_t *ll)
if ((link = list_remove_first(&reconnectl))) { if ((link = list_remove_first(&reconnectl))) {
conn = irc_server_connect(link); conn = irc_server_connect(link);
list_add_last(&connl, conn); list_add_last(&connl, conn);
link->last_connection = time(NULL);
} }
} }
@ -1972,7 +1973,6 @@ void irc_main(connection_t *inc, list_t *ll)
if (l->recon_timer <= 0) { if (l->recon_timer <= 0) {
list_it_remove(&li); list_it_remove(&li);
list_add_last(&reconnectl, l); list_add_last(&reconnectl, l);
l->last_reconnection = time(NULL);
} else { } else {
l->recon_timer--; l->recon_timer--;
} }

View File

@ -69,7 +69,7 @@ struct link {
/* connection state (reconnecting, was_connected ...) */ /* connection state (reconnecting, was_connected ...) */
int recon_timer; int recon_timer;
time_t last_reconnection; time_t last_connection;
/** link options */ /** link options */