mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Correctly handle excessive web sessions
The old code didn't actually destroy the session, but only made sure we couldn't use it anymore. What a waste of memory. This was tested by adding a DEBUG()-call to CWebSock::~CWebSock(): Before this patch: Page Request [/] Remote IP: 127.0.0.1; discarding session [ca104adaa54f933b6b8394e88e68ab0d22e0fc227ed23e93d1421e4d3fda8211] Auto generated session: [d40364e8d0a55432b86a1b2598865c2323e35cc6e77cade35b9a1b7605712ca6] After this patch: Page Request [/] Remote IP: 127.0.0.1; discarding session [707e3b262fe47b93d8c796354574506c398cc5b5d84aa2972dc3d031d8f731f5] Destroying session [707e3b262fe47b93d8c796354574506c398cc5b5d84aa2972dc3d031d8f731f5, 127.0.0.1 for <unknown> Auto generated session: [47de1c82a8b6eaae54a9cc8c29163ab53ec2add7198cf1df7f80506ea1bda2b6] Obviously, the destructor is only called after this change. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -729,7 +729,7 @@ CSmartPtr<CWebSession> CWebSock::GetSession() {
|
||||
if (Sessions.m_mIPSessions.count(GetRemoteIP()) > m_uiMaxSessions) {
|
||||
mIPSessionsIterator it = Sessions.m_mIPSessions.find(GetRemoteIP());
|
||||
DEBUG("Remote IP: " << GetRemoteIP() << "; discarding session [" << it->second->GetId() << "]");
|
||||
Sessions.m_mIPSessions.erase(it);
|
||||
Sessions.m_mspSessions.RemItem(it->second->GetId());
|
||||
}
|
||||
|
||||
CString sSessionID;
|
||||
|
||||
Reference in New Issue
Block a user