mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-25 15:06:21 +02:00
fixed crash during shutdown
This commit is contained in:
parent
438523f527
commit
4db8696889
3 changed files with 9 additions and 2 deletions
|
@ -33,6 +33,11 @@ ControlServer::ControlServer(const ControlServerSettings& controlServerSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ControlServer::~ControlServer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlServer::send(const msg::BaseMessage* message)
|
void ControlServer::send(const msg::BaseMessage* message)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> mlock(mutex_);
|
std::unique_lock<std::mutex> mlock(mutex_);
|
||||||
|
@ -160,9 +165,10 @@ void ControlServer::start()
|
||||||
|
|
||||||
void ControlServer::stop()
|
void ControlServer::stop()
|
||||||
{
|
{
|
||||||
io_service_.stop();
|
|
||||||
acceptor_->cancel();
|
acceptor_->cancel();
|
||||||
|
io_service_.stop();
|
||||||
acceptThread_.join();
|
acceptThread_.join();
|
||||||
|
pipeReader_->stop();
|
||||||
std::unique_lock<std::mutex> mlock(mutex_);
|
std::unique_lock<std::mutex> mlock(mutex_);
|
||||||
for (auto it = sessions_.begin(); it != sessions_.end(); ++it)
|
for (auto it = sessions_.begin(); it != sessions_.end(); ++it)
|
||||||
(*it)->stop();
|
(*it)->stop();
|
||||||
|
|
|
@ -61,6 +61,7 @@ class ControlServer : public MessageReceiver, PipeListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ControlServer(const ControlServerSettings& controlServerSettings);
|
ControlServer(const ControlServerSettings& controlServerSettings);
|
||||||
|
virtual ~ControlServer();
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
|
@ -113,7 +113,7 @@ void OggEncoder::encode(const msg::PcmChunk* chunk)
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
{
|
{
|
||||||
res /= (sampleFormat_.rate / 1000.);
|
res /= (sampleFormat_.rate / 1000.);
|
||||||
logO << "res: " << res << "\n";
|
// logO << "res: " << res << "\n";
|
||||||
lastGranulepos = os.granulepos;
|
lastGranulepos = os.granulepos;
|
||||||
// make oggChunk smaller
|
// make oggChunk smaller
|
||||||
oggChunk->payload = (char*)realloc(oggChunk->payload, pos);
|
oggChunk->payload = (char*)realloc(oggChunk->payload, pos);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue