Fix crash during shutdown

In case there are multiple PosixStreams with the same name, the server crashed during shutdown
This commit is contained in:
badaix 2020-01-06 18:50:57 +01:00
parent e12fa3fc7d
commit 062e46060c
4 changed files with 9 additions and 7 deletions

View file

@ -799,10 +799,11 @@ void StreamServer::start()
{
try
{
controlServer_.reset(new ControlServer(io_context_, settings_.tcp, settings_.http, this));
controlServer_ = std::make_unique<ControlServer>(io_context_, settings_.tcp, settings_.http, this);
controlServer_->start();
streamManager_.reset(new StreamManager(this, io_context_, settings_.stream.sampleFormat, settings_.stream.codec, settings_.stream.streamChunkMs));
streamManager_ =
std::make_unique<StreamManager>(this, io_context_, settings_.stream.sampleFormat, settings_.stream.codec, settings_.stream.streamChunkMs);
// throw SnapException("xxx");
for (const auto& streamUri : settings_.stream.pcmStreams)
{