diff options
author | Timo Sirainen <cras@irssi.org> | 2001-12-01 19:44:54 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-12-01 19:44:54 +0000 |
commit | ed7d5addc94fa0c7c1fd19bc72c8c39ac1aff4ee (patch) | |
tree | fe65b326fe431561b9b429e72ce6ddc263104d93 /src | |
parent | fa37db9205c3ddbdaa481370492ccd72f9a6fb64 (diff) | |
download | irssi-ed7d5addc94fa0c7c1fd19bc72c8c39ac1aff4ee.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-servers.h | 1 | ||||
-rw-r--r-- | src/irc/core/lag.c | 22 |
3 files changed, 24 insertions, 1 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 0ed73ff8..2cd33806 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -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); diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h index 957a3022..4cd22728 100644 --- a/src/irc/core/irc-servers.h +++ b/src/irc/core/irc-servers.h @@ -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 */ diff --git a/src/irc/core/lag.c b/src/irc/core/lag.c index 13135dd4..e919b3fc 100644 --- a/src/irc/core/lag.c +++ b/src/irc/core/lag.c @@ -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); } |