summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2018-04-06 10:50:58 +0200
committerGitHub <noreply@github.com>2018-04-06 10:50:58 +0200
commitb2b1ac670879ed49ebf87acc4e33212a21e8df66 (patch)
treebdfb1bccdabc08142e98335e09e3cb9569dc9883
parent4d5a7507196c7f5337c846417650bb3c54d523b2 (diff)
parentc08685a1a3e4a719fcfe8f30a338a91db8c3b8d1 (diff)
downloadirssi-b2b1ac670879ed49ebf87acc4e33212a21e8df66.zip
Merge pull request #866 from ailin-nemui/reconnects
This is a simple change which might fix #130 The lookup_servers are also disconnected if the lookup/SSL handshake doesn't succeed in time. I'm not perfectly sure if this is the master fix but it does seem to be an issue that servers can be stuck in lookup, especially for SSL. See the issue for a reproducer
-rw-r--r--src/core/servers-reconnect.c15
-rw-r--r--src/core/servers.c1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index 1727704c..5f609cf5 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -111,6 +111,21 @@ static int server_reconnect_timeout(void)
}
}
+ for (tmp = lookup_servers; tmp != NULL; tmp = next) {
+ SERVER_REC *server = tmp->data;
+
+ next = tmp->next;
+ if (server->connect_time + connect_timeout < now &&
+ connect_timeout > 0) {
+ if (server->connect_tag != -1) {
+ g_source_remove(server->connect_tag);
+ server->connect_tag = -1;
+ }
+ server->connection_lost = TRUE;
+ server_connect_failed(server, "Timeout");
+ }
+ }
+
/* If server_connect() removes the next reconnection in queue,
we're screwed. I don't think this should happen anymore, but just
to be sure we don't crash, do this safely. */
diff --git a/src/core/servers.c b/src/core/servers.c
index 11eccc53..81bdb89e 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -426,6 +426,7 @@ int server_start_connect(SERVER_REC *server)
server_connect_callback_readpipe,
server);
+ server->connect_time = time(NULL);
lookup_servers = g_slist_append(lookup_servers, server);
signal_emit("server looking", 1, server);