Merge pull request #838 from majestrate/sam-crash-fix-2017-03-29

try fixing sam crashyness
This commit is contained in:
orignal 2017-03-29 15:01:22 -04:00 committed by GitHub
commit 3d1b6e29c6
2 changed files with 7 additions and 6 deletions

View file

@ -789,13 +789,14 @@ namespace client
void SAMSession::CloseStreams ()
{
std::vector<std::shared_ptr<SAMSocket> > socks;
{
std::lock_guard<std::mutex> lock(m_SocketsMutex);
for (auto& sock : m_Sockets) {
sock->CloseStream();
for (const auto& sock : m_Sockets) {
socks.push_back(sock);
}
}
// XXX: should this be done inside locked parts?
for (auto & sock : socks ) sock->Terminate();
m_Sockets.clear();
}