mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-24 22:46:14 +02:00
Process messages asynchronously
This commit is contained in:
parent
5e2d14d39a
commit
0eaee48f10
10 changed files with 106 additions and 89 deletions
|
@ -61,9 +61,10 @@ void ControlSessionTcp::do_read()
|
|||
// LOG(DEBUG, LOG_TAG) << "received: " << line << "\n";
|
||||
if ((message_receiver_ != nullptr) && !line.empty())
|
||||
{
|
||||
string response = message_receiver_->onMessageReceived(this, line);
|
||||
if (!response.empty())
|
||||
sendAsync(response);
|
||||
message_receiver_->onMessageReceived(shared_from_this(), line, [this](const std::string& response) {
|
||||
if (!response.empty())
|
||||
sendAsync(response);
|
||||
});
|
||||
}
|
||||
}
|
||||
streambuf_.consume(bytes_transferred);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue