mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 16:16:42 +02:00
fixed deadlock in server shutdown
This commit is contained in:
parent
341466ceb5
commit
935899b0a2
5 changed files with 35 additions and 23 deletions
|
@ -404,16 +404,24 @@ void StreamServer::start()
|
|||
|
||||
void StreamServer::stop()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
|
||||
for (auto session: sessions_)//it = sessions_.begin(); it != sessions_.end(); ++it)
|
||||
if (streamManager_)
|
||||
{
|
||||
if (session)
|
||||
{
|
||||
session->stop();
|
||||
session = nullptr;
|
||||
}
|
||||
streamManager_->stop();
|
||||
streamManager_ = nullptr;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
|
||||
for (auto session: sessions_)//it = sessions_.begin(); it != sessions_.end(); ++it)
|
||||
{
|
||||
if (session)
|
||||
{
|
||||
session->stop();
|
||||
session = nullptr;
|
||||
}
|
||||
}
|
||||
sessions_.clear();
|
||||
}
|
||||
sessions_.clear();
|
||||
|
||||
if (controlServer_)
|
||||
{
|
||||
|
@ -426,11 +434,5 @@ void StreamServer::stop()
|
|||
acceptor_->cancel();
|
||||
acceptor_ = nullptr;
|
||||
}
|
||||
|
||||
if (streamManager_)
|
||||
{
|
||||
streamManager_->stop();
|
||||
streamManager_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue