summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc/irc-server.c')
-rw-r--r--src/plugins/irc/irc-server.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 66663f910..0f5055c80 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2842,7 +2842,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
}
/* lag timeout? => disconnect */
if ((weechat_config_integer (irc_config_network_lag_reconnect) > 0)
- && (ptr_server->lag / 1000 > weechat_config_integer (irc_config_network_lag_reconnect)))
+ && (ptr_server->lag >= weechat_config_integer (irc_config_network_lag_reconnect) * 1000))
{
weechat_printf (ptr_server->buffer,
_("%s%s: lag is high, reconnecting to "
@@ -2854,6 +2854,23 @@ irc_server_timer_cb (void *data, int remaining_calls)
IRC_COLOR_RESET);
irc_server_disconnect (ptr_server, 0, 1);
}
+ else
+ {
+ /* stop lag counting if max lag is reached */
+ if ((weechat_config_integer (irc_config_network_lag_max) > 0)
+ && (ptr_server->lag >= (weechat_config_integer (irc_config_network_lag_max) * 1000)))
+ {
+ /* refresh lag item */
+ ptr_server->lag_last_refresh = current_time;
+ weechat_bar_item_update ("lag");
+
+ /* schedule next lag check in 5 seconds */
+ ptr_server->lag_check_time.tv_sec = 0;
+ ptr_server->lag_check_time.tv_usec = 0;
+ ptr_server->lag_next_check = time (NULL) +
+ weechat_config_integer (irc_config_network_lag_check);
+ }
+ }
}
/* remove redirects if timeout occurs */