WebModules: Fix a crash during shutdown

During shutdown, the global list of sessions is destroyed. The new multimap
which counts sessions per address is also destroyed. However, they are destroyed
in unspecified order. This is not what we want because destructing the session
map also destroyed all the sessions which then has to access the sessions-per-ip
multimap. This obviously crashes if the multimap was already destroyed.

The fix here is to introduce a new class that contains both of those maps and
makes sure all the sessions are destroyed before the maps are destroyed
themselves. I hope this description makes some sense...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2264 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2011-01-14 22:03:33 +00:00
parent 913a3c8ded
commit bf6dc459db
2 changed files with 32 additions and 18 deletions
+1 -4
View File
@@ -147,9 +147,7 @@ public:
CString GetRequestCookie(const CString& sKey);
bool SendCookie(const CString& sKey, const CString& sValue);
static void FinishUserSessions(const CUser& User) {
m_mspSessions.FinishUserSessions(User);
}
static void FinishUserSessions(const CUser& User);
protected:
using CHTTPSock::PrintErrorPage;
@@ -171,7 +169,6 @@ private:
CString m_sPage; // Gets filled by ParsePath()
CSmartPtr<CWebSession> m_spSession;
static CWebSessionMap m_mspSessions;
static const unsigned int m_uiMaxSessions;
};