Fixed sending error messages before closing session.

This commit is contained in:
lotodore
2009-02-05 19:29:44 +00:00
parent 8f59de0c62
commit ac7d448d09
+6 -1
View File
@@ -212,7 +212,12 @@ SenderThread::Main()
if (pos != m_sendQueueMap.end())
{
// Remove session if no write is in progress, else wait.
if (!pos->second->writeInProgress)
bool shouldDelete;
{
boost::mutex::scoped_lock lock(pos->second->dataMutex);
shouldDelete = (!pos->second->writeInProgress && pos->second->list.empty());
}
if (shouldDelete)
m_sendQueueMap.erase(pos);
else
newRemovedSessions.push_back(*i);