mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 15:46:42 +02:00
Pop message from queue before sending it
This commit is contained in:
parent
ae9ecf00e3
commit
c445deb95a
2 changed files with 3 additions and 3 deletions
|
@ -626,7 +626,7 @@ void StreamServer::onMessageReceived(StreamSession* streamSession, const msg::Ba
|
||||||
timeMsg->refersTo = timeMsg->id;
|
timeMsg->refersTo = timeMsg->id;
|
||||||
timeMsg->latency = timeMsg->received - timeMsg->sent;
|
timeMsg->latency = timeMsg->received - timeMsg->sent;
|
||||||
// LOG(INFO) << "Latency sec: " << timeMsg.latency.sec << ", usec: " << timeMsg.latency.usec << ", refers to: " << timeMsg.refersTo << "\n";
|
// LOG(INFO) << "Latency sec: " << timeMsg.latency.sec << ", usec: " << timeMsg.latency.usec << ", refers to: " << timeMsg.refersTo << "\n";
|
||||||
streamSession->sendAsync(timeMsg);
|
streamSession->sendAsync(timeMsg, true);
|
||||||
|
|
||||||
// refresh streamSession state
|
// refresh streamSession state
|
||||||
ClientInfoPtr client = Config::instance().getClientInfo(streamSession->clientId);
|
ClientInfoPtr client = Config::instance().getClientInfo(streamSession->clientId);
|
||||||
|
|
|
@ -128,10 +128,10 @@ void StreamSession::stop()
|
||||||
|
|
||||||
void StreamSession::send_next()
|
void StreamSession::send_next()
|
||||||
{
|
{
|
||||||
auto buffer = messages_.front();
|
shared_const_buffer buffer = messages_.front();
|
||||||
|
messages_.pop_front();
|
||||||
boost::asio::async_write(socket_, buffer,
|
boost::asio::async_write(socket_, buffer,
|
||||||
boost::asio::bind_executor(strand_, [ this, self = shared_from_this(), buffer ](boost::system::error_code ec, std::size_t length) {
|
boost::asio::bind_executor(strand_, [ this, self = shared_from_this(), buffer ](boost::system::error_code ec, std::size_t length) {
|
||||||
messages_.pop_front();
|
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
LOG(ERROR, LOG_TAG) << "StreamSession write error (msg length: " << length << "): " << ec.message() << "\n";
|
LOG(ERROR, LOG_TAG) << "StreamSession write error (msg length: " << length << "): " << ec.message() << "\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue