From 7545f463bd279359a56521ff6114634dc4d0ea6f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 16 Nov 2001 23:42:09 +0000 Subject: [PATCH] Allow replies to redirections come in a bit different order than expected - default is if 3 replies to other redirections are received, abort the expected one. This is because some IRC bouncers reply to some of the commands (PING) themself immediately. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2036 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/servers-redirect.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c index 424e7e7e..a6a1a38d 100644 --- a/src/irc/core/servers-redirect.c +++ b/src/irc/core/servers-redirect.c @@ -28,6 +28,11 @@ #define DEFAULT_REDIRECT_TIMEOUT 60 +/* Allow 2 non-expected redirections to come before the expected one + before aborting it. Some IRC bouncers/proxies reply to eg. PINGs + immediately. */ +#define MAX_FAILURE_COUNT 2 + typedef struct { char *name; int refcount; @@ -40,6 +45,7 @@ typedef struct { struct _REDIRECT_REC { REDIRECT_CMD_REC *cmd; time_t created; + int failures; int destroyed; char *arg; @@ -411,8 +417,10 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event, next = tmp->next; if (rec->destroyed || (rec->remote && (now-rec->created) > rec->cmd->timeout) || - (!rec->remote && redirect != NULL)) - redirect_abort(server, rec); + (!rec->remote && redirect != NULL)) { + if (rec->remote || ++rec->failures >= MAX_FAILURE_COUNT) + redirect_abort(server, rec); + } } return redirect;