1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

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
This commit is contained in:
Timo Sirainen 2001-11-16 23:42:09 +00:00 committed by cras
parent 15933dcea0
commit 7545f463bd

View File

@ -28,6 +28,11 @@
#define DEFAULT_REDIRECT_TIMEOUT 60 #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 { typedef struct {
char *name; char *name;
int refcount; int refcount;
@ -40,6 +45,7 @@ typedef struct {
struct _REDIRECT_REC { struct _REDIRECT_REC {
REDIRECT_CMD_REC *cmd; REDIRECT_CMD_REC *cmd;
time_t created; time_t created;
int failures;
int destroyed; int destroyed;
char *arg; char *arg;
@ -411,8 +417,10 @@ static REDIRECT_REC *redirect_find(IRC_SERVER_REC *server, const char *event,
next = tmp->next; next = tmp->next;
if (rec->destroyed || if (rec->destroyed ||
(rec->remote && (now-rec->created) > rec->cmd->timeout) || (rec->remote && (now-rec->created) > rec->cmd->timeout) ||
(!rec->remote && redirect != NULL)) (!rec->remote && redirect != NULL)) {
redirect_abort(server, rec); if (rec->remote || ++rec->failures >= MAX_FAILURE_COUNT)
redirect_abort(server, rec);
}
} }
return redirect; return redirect;