From 5a72f20c2cef869518e27eef1746783394c66d05 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 4 Oct 2011 01:08:12 +0200 Subject: [PATCH] Limit sent_parsed to the highest possible value in the current config. After a configuration change (or deoper with no_oper_flood) sent_parsed might be way higher than allow_read, so that the user would have to wait a long time before the server responds. Avoid this. --- src/packet.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/packet.c b/src/packet.c index 0fe061a7d..73f08c18a 100644 --- a/src/packet.c +++ b/src/packet.c @@ -84,6 +84,11 @@ parse_client_queued(struct Client *client_p) } } + /* If sent_parsed is impossibly high, drop it down. + * This is useful if the configuration is changed. + */ + if(client_p->localClient->sent_parsed > allow_read) + client_p->localClient->sent_parsed = allow_read; } if(IsAnyServer(client_p) || IsExemptFlood(client_p)) @@ -143,6 +148,13 @@ parse_client_queued(struct Client *client_p) client_p->localClient->sent_parsed += ConfigFileEntry.client_flood_message_time; } + /* If sent_parsed is impossibly high, drop it down. + * This is useful if the configuration is changed. + */ + if(client_p->localClient->sent_parsed > allow_read + + ConfigFileEntry.client_flood_message_time - 1) + client_p->localClient->sent_parsed = allow_read + + ConfigFileEntry.client_flood_message_time - 1; } }