From 85d0060426a416bba1c952a024e2d5f03ff53383 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 1 Dec 2001 20:36:44 +0000 Subject: Don't fail the remote redirections either until MAX_FAILURE_COUNT redirections have gone without reply to our redirection. This is because the timeout itself may fail if lag to the server is too high. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2177 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/servers-redirect.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/irc/core') diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 8fa456bb..7258414e 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -411,6 +411,10 @@ static void redirect_abort(IRC_SERVER_REC *server, REDIRECT_REC *rec) server_redirect_destroy(rec); } +#define REDIRECT_IS_TIMEOUTED(rec) \ + ((now-(rec)->created) > (rec)->cmd->timeout) + + static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, const char *args, const char **signal, int *match) @@ -442,13 +446,18 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, if (rec == redirect) break; - next = tmp->next; - if (rec->destroyed || - (rec->remote && (now-rec->created) > rec->cmd->timeout) || - (!rec->remote && redirect != NULL)) { - if (rec->aborted || rec->remote || - ++rec->failures >= MAX_FAILURE_COUNT) - redirect_abort(server, rec); + next = tmp->next; + if (rec->destroyed) { + /* redirection is finished, destroy it */ + redirect_abort(server, rec); + } else if (redirect != NULL) { + /* check if redirection failed */ + if (rec->aborted || + ++rec->failures >= MAX_FAILURE_COUNT) { + /* enough failures, abort it now */ + if (!rec->remote || REDIRECT_IS_TIMEOUTED(rec)) + redirect_abort(server, rec); + } } } -- cgit v1.2.3