mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-15 18:16:44 +02:00
fixed exception during server shutdown
This commit is contained in:
parent
748c4c06b1
commit
7353383313
5 changed files with 15 additions and 6 deletions
|
@ -1,6 +1,5 @@
|
|||
*TODO:
|
||||
-Server ping client?
|
||||
-Server: OnResync while terminating?!?
|
||||
-LastSeen: relative time [s] or [ms]?
|
||||
-Android crash: Empty latency => app restart => empty client list
|
||||
-Segfault when ^c on OpenWrt with client connected
|
||||
|
|
|
@ -104,7 +104,7 @@ void FileStream::worker()
|
|||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
logE << "Exception: " << e.what() << std::endl;
|
||||
logE << "(FileStream) Exception: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ void PcmStream::stop()
|
|||
if (active_)
|
||||
{
|
||||
active_ = false;
|
||||
if (readerThread_.joinable())
|
||||
readerThread_.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,9 @@ void PipeStream::worker()
|
|||
}
|
||||
while ((len < toRead) && active_);
|
||||
|
||||
if (!active_)
|
||||
break;
|
||||
|
||||
encoder_->encode(chunk.get());
|
||||
nextTick += pcmReadMs_;
|
||||
chronos::addUs(tvChunk, pcmReadMs_ * 1000);
|
||||
|
@ -118,7 +121,7 @@ void PipeStream::worker()
|
|||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
logE << "Exception: " << e.what() << std::endl;
|
||||
logE << "(PipeStream) Exception: " << e.what() << std::endl;
|
||||
chronos::sleep(100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,9 @@ void ProcessStream::stop()
|
|||
if (process_)
|
||||
process_->kill();
|
||||
PcmStream::stop();
|
||||
|
||||
/// thread is detached, so it is not joinable
|
||||
if (stderrReaderThread_.joinable())
|
||||
stderrReaderThread_.join();
|
||||
}
|
||||
|
||||
|
@ -181,6 +184,9 @@ void ProcessStream::worker()
|
|||
}
|
||||
while ((len < toRead) && active_);
|
||||
|
||||
if (!active_)
|
||||
break;
|
||||
|
||||
encoder_->encode(chunk.get());
|
||||
nextTick += pcmReadMs_;
|
||||
chronos::addUs(tvChunk, pcmReadMs_ * 1000);
|
||||
|
@ -202,7 +208,7 @@ void ProcessStream::worker()
|
|||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
logE << "Exception: " << e.what() << std::endl;
|
||||
logE << "(ProcessStream) Exception: " << e.what() << std::endl;
|
||||
process_->kill();
|
||||
int sleepMs = 30000;
|
||||
while (active_ && (sleepMs > 0))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue