Fixed network game termination.

This commit is contained in:
lotodore
2009-06-04 22:13:52 +00:00
parent 8005cc82c6
commit 55bd832955
3 changed files with 18 additions and 5 deletions
+8 -1
View File
@@ -31,6 +31,7 @@ SessionManager::SessionManager()
SessionManager::~SessionManager()
{
Clear();
}
bool
@@ -343,8 +344,14 @@ void
SessionManager::Clear()
{
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
SessionMap::iterator i = m_sessionMap.begin();
SessionMap::iterator end = m_sessionMap.end();
// Sockets will be closed automatically.
while (i != end)
{
i->second.sessionData->GetAsioSocket()->close();
++i;
}
m_sessionMap.clear();
}