From 96c92ef8cae447156231db9d01c73696192ccfb2 Mon Sep 17 00:00:00 2001 From: Rubin Date: Mon, 29 May 2017 01:23:44 -0700 Subject: [PATCH] Change default flood rates to match RFC1459, prevent excess flood problems I noticed that the default network flood rates are wrong (for most networks). It has been very standard since the beginning of IRC to use a value of 2 seconds per line, with a 10 line head start. Almost all networks work this way, and if you don't follow, having a lot of channels or a lot of clients connected to ZNC results in excess flood disconnections and much frustration for the user. I think you should make the default value for these 2 and 9 instead of 1 and 4 so that this nasty bug doesn't hit people who will not know how to debug it. You find these same types of settings built into every IRC client. 2 and 10 is the standard. 2 and 9 provides a slight buffer so there is no mistake. Thanks -Rubin Close #1416 --- modules/data/webadmin/tmpl/add_edit_network.tmpl | 4 ++-- modules/webadmin.cpp | 4 ++-- src/IRCNetwork.cpp | 4 ++-- test/integration/main.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/data/webadmin/tmpl/add_edit_network.tmpl b/modules/data/webadmin/tmpl/add_edit_network.tmpl index fc122467..a1d05f7a 100644 --- a/modules/data/webadmin/tmpl/add_edit_network.tmpl +++ b/modules/data/webadmin/tmpl/add_edit_network.tmpl @@ -135,7 +135,7 @@ " - value="" value="1.00" disabled="disabled" /> + value="" value="2.00" disabled="disabled" /> @@ -145,7 +145,7 @@ " - value="" value="4" disabled="disabled" /> + value="" value="9" disabled="disabled" /> diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index 6ec5d04e..1edc03ae 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -1000,8 +1000,8 @@ class CWebAdminMod : public CModule { Tmpl["TrustAllCerts"] = "false"; Tmpl["TrustPKI"] = "true"; Tmpl["FloodProtection"] = "true"; - Tmpl["FloodRate"] = "1.0"; - Tmpl["FloodBurst"] = "4"; + Tmpl["FloodRate"] = "2.0"; + Tmpl["FloodBurst"] = "9"; Tmpl["JoinDelay"] = "0"; breadNet["Text"] = t_s("Add Network"); } diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index 6e06d0ed..63f15089 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -152,8 +152,8 @@ CIRCNetwork::CIRCNetwork(CUser* pUser, const CString& sName) m_uServerIdx(0), m_IRCNick(), m_bIRCAway(false), - m_fFloodRate(1), - m_uFloodBurst(4), + m_fFloodRate(2), + m_uFloodBurst(9), m_RawBuffer(), m_MotdBuffer(), m_NoticeBuffer(), diff --git a/test/integration/main.cpp b/test/integration/main.cpp index 130dd145..7040ef41 100644 --- a/test/integration/main.cpp +++ b/test/integration/main.cpp @@ -799,11 +799,11 @@ TEST_F(ZNCTest, ControlpanelModule) { Z; client.Write(request + "GetNetwork FloodRate user freenode"); - client.ReadUntil(response + "FloodRate = 1.00"); + client.ReadUntil(response + "FloodRate = 2.00"); Z; client.Write(request + "GetNetwork FloodBurst user freenode"); - client.ReadUntil(response + "FloodBurst = 4"); + client.ReadUntil(response + "FloodBurst = 9"); Z; client.Write(request + "GetNetwork JoinDelay user freenode"); @@ -1386,11 +1386,11 @@ TEST_F(ZNCTest, ControlpanelModule) { Z; client.Write(request + "GetNetwork FloodRate KindOne freenode"); - client.ReadUntil(response + "FloodRate = 1.00"); + client.ReadUntil(response + "FloodRate = 2.00"); Z; client.Write(request + "GetNetwork FloodBurst KindOne freenode"); - client.ReadUntil(response + "FloodBurst = 4"); + client.ReadUntil(response + "FloodBurst = 9"); Z; client.Write(request + "GetNetwork JoinDelay KindOne freenode");