Add new global setting MaxBufferSize

Previously, /znc setbuffer had a hardcoded limit of 500, other ways of setting
the buffer size didn't have any limit built-in.

This patch makes that limit configurable and makes sure the various places
honour it.

Thanks to DarthGandalf for the idea with the bForce argument, I were too
small-minded to come up with it myself. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2020 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-06-12 20:20:33 +00:00
parent a8b011fd50
commit e62ca4112d
9 changed files with 52 additions and 22 deletions
+6 -2
View File
@@ -39,6 +39,7 @@ CZNC::CZNC() {
SetISpoofFormat(""); // Set ISpoofFormat to default
m_uBytesRead = 0;
m_uBytesWritten = 0;
m_uiMaxBufferSize = 500;
m_pConnectUserTimer = NULL;
m_eConfigState = ECONFIG_NOTHING;
m_TimeStarted = time(NULL);
@@ -1266,7 +1267,7 @@ bool CZNC::DoRehash(CString& sError)
if (pUser) {
if (pChan) {
if (sName.Equals("Buffer")) {
pChan->SetBufferCount(sValue.ToUInt());
pChan->SetBufferCount(sValue.ToUInt(), true);
continue;
} else if (sName.Equals("KeepBuffer")) {
pChan->SetKeepBuffer(sValue.Equals("true"));
@@ -1288,7 +1289,7 @@ bool CZNC::DoRehash(CString& sError)
}
} else {
if (sName.Equals("Buffer")) {
pUser->SetBufferCount(sValue.ToUInt());
pUser->SetBufferCount(sValue.ToUInt(), true);
continue;
} else if (sName.Equals("KeepBuffer")) {
pUser->SetKeepBuffer(sValue.Equals("true"));
@@ -1626,6 +1627,9 @@ bool CZNC::DoRehash(CString& sError)
} else if (sName.Equals("AnonIPLimit")) {
m_uiAnonIPLimit = sValue.ToUInt();
continue;
} else if (sName.Equals("MaxBufferSize")) {
m_uiMaxBufferSize = sValue.ToUInt();
continue;
}
}