diff options
author | Timo Sirainen <cras@irssi.org> | 2001-12-01 20:36:44 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-12-01 20:36:44 +0000 |
commit | 85d0060426a416bba1c952a024e2d5f03ff53383 (patch) | |
tree | 54fb8f1b1dfa50dc5281313e0e8240121d899acc /src/irc/core/servers-redirect.c | |
parent | 5524f89d719267efc0d549dffc2ada213cbfcc63 (diff) | |
download | irssi-85d0060426a416bba1c952a024e2d5f03ff53383.zip |
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
Diffstat (limited to 'src/irc/core/servers-redirect.c')
-rw-r--r-- | src/irc/core/servers-redirect.c | 23 |
1 files changed, 16 insertions, 7 deletions
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); + } } } |