From 92eaf0dc9a198d92115d306554b3ddbfe18b7c97 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 22 Jan 2002 21:04:04 +0000 Subject: [PATCH] Never reconnect immediately to server when server is being disconnected - this could lead scripts (or maybe even irssi itself) handle the partially disconnected server wrong. Also moved the server->disconnected = TRUE before the "server disconnected" signal is sent, this makes sure the server_disconnect() is never called twice. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2339 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/servers-reconnect.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index 429ffc43..e51a3fa2 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -115,13 +115,7 @@ static void sserver_connect(SERVER_SETUP_REC *rec, SERVER_CONNECT_REC *conn) if (conn->port == 0) conn->port = rec->port; server_setup_fill_reconn(conn, rec); - if (rec->last_connect > time(NULL)-reconnect_time) { - /* can't reconnect this fast, wait.. */ - server_reconnect_add(conn, rec->last_connect+reconnect_time); - } else { - /* connect to server.. */ - CHAT_PROTOCOL(conn)->server_connect(conn); - } + server_reconnect_add(conn, rec->last_connect+reconnect_time); server_connect_unref(conn); } @@ -224,16 +218,8 @@ static void sig_reconnect(SERVER_REC *server) conn->port = server->connrec->port; conn->password = g_strdup(server->connrec->password); - if (server->connect_time != 0 && - time(NULL)-server->connect_time > reconnect_time) { - /* there's been enough time since last connection, - reconnect back immediately */ - CHAT_PROTOCOL(conn)->server_connect(conn); - } else { - /* reconnect later.. */ - server_reconnect_add(conn, (server->connect_time == 0 ? time(NULL) : - server->connect_time) + reconnect_time); - } + server_reconnect_add(conn, (server->connect_time == 0 ? time(NULL) : + server->connect_time) + reconnect_time); server_connect_unref(conn); return; }