1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Disable lag detection in servers that don't understand PING command (yes,

there was at least one..)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2174 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-12-01 19:44:54 +00:00 committed by cras
parent fa37db9205
commit ed7d5addc9
3 changed files with 24 additions and 1 deletions

View File

@ -829,6 +829,7 @@ void fe_events_numeric_init(void)
signal_add("event 364", (SIGNAL_FUNC) event_received);
signal_add("event 365", (SIGNAL_FUNC) event_received);
signal_add("event 381", (SIGNAL_FUNC) event_received);
signal_add("event 421", (SIGNAL_FUNC) event_received);
signal_add("event 432", (SIGNAL_FUNC) event_received);
signal_add("event 438", (SIGNAL_FUNC) event_received);
signal_add("event 465", (SIGNAL_FUNC) event_received);
@ -905,6 +906,7 @@ void fe_events_numeric_deinit(void)
signal_remove("event 364", (SIGNAL_FUNC) event_received);
signal_remove("event 365", (SIGNAL_FUNC) event_received);
signal_remove("event 381", (SIGNAL_FUNC) event_received);
signal_remove("event 421", (SIGNAL_FUNC) event_received);
signal_remove("event 432", (SIGNAL_FUNC) event_received);
signal_remove("event 438", (SIGNAL_FUNC) event_received);
signal_remove("event 465", (SIGNAL_FUNC) event_received);

View File

@ -55,6 +55,7 @@ struct _IRC_SERVER_REC {
unsigned int no_multi_mode:1; /* Server doesn't understand MODE #chan1,#chan2,... */
unsigned int no_multi_who:1; /* Server doesn't understand WHO #chan1,#chan2,... */
unsigned int one_endofwho:1; /* /WHO #a,#b,.. replies only with one End of WHO message */
unsigned int disable_lag:1; /* Disable lag detection (PING command doesn't exist) */
int max_kicks_in_cmd; /* max. number of people to kick with one /KICK command */
int max_modes_in_cmd; /* max. number of mode changes in one /MODE command */

View File

@ -64,6 +64,24 @@ static void lag_event_pong(IRC_SERVER_REC *server, const char *data,
signal_emit("server lag", 1, server);
}
static void sig_unknown_command(IRC_SERVER_REC *server, const char *data)
{
char *params, *cmd;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &cmd);
if (g_strcasecmp(cmd, "PING") == 0) {
/* some servers have disabled PING command, don't bother
trying alternative methods to detect lag with these
servers. */
server->disable_lag = TRUE;
server->lag_sent.tv_sec = 0;
server->lag = 0;
}
g_free(params);
}
static int sig_check_lag(void)
{
GSList *tmp, *next;
@ -81,7 +99,7 @@ static int sig_check_lag(void)
IRC_SERVER_REC *rec = tmp->data;
next = tmp->next;
if (!IS_IRC_SERVER(rec))
if (!IS_IRC_SERVER(rec) || rec->disable_lag)
continue;
if (rec->lag_sent.tv_sec != 0) {
@ -110,6 +128,7 @@ void lag_init(void)
timeout_tag = g_timeout_add(1000, (GSourceFunc) sig_check_lag, NULL);
signal_add_first("lag pong", (SIGNAL_FUNC) lag_event_pong);
signal_add("lag ping error", (SIGNAL_FUNC) lag_ping_error);
signal_add("event 421", (SIGNAL_FUNC) sig_unknown_command);
}
void lag_deinit(void)
@ -117,4 +136,5 @@ void lag_deinit(void)
g_source_remove(timeout_tag);
signal_remove("lag pong", (SIGNAL_FUNC) lag_event_pong);
signal_remove("lag ping error", (SIGNAL_FUNC) lag_ping_error);
signal_remove("event 421", (SIGNAL_FUNC) sig_unknown_command);
}