mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-25 23:16:14 +02:00
Fix crash while calling Stream.RemoveStream
This commit is contained in:
parent
61bda79158
commit
780d8f3f1a
6 changed files with 20 additions and 19 deletions
|
@ -73,7 +73,7 @@ void TcpStream::connect()
|
|||
|
||||
if (is_server_)
|
||||
{
|
||||
acceptor_->async_accept([this](boost::system::error_code ec, tcp::socket socket)
|
||||
acceptor_->async_accept([this, self = shared_from_this()](boost::system::error_code ec, tcp::socket socket)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ void TcpStream::connect()
|
|||
{
|
||||
stream_ = make_unique<tcp::socket>(strand_);
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::make_address(host_), port_);
|
||||
stream_->async_connect(endpoint, [this](const boost::system::error_code& ec)
|
||||
stream_->async_connect(endpoint, [this, self = shared_from_this()](const boost::system::error_code& ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ void TcpStream::connect()
|
|||
else
|
||||
{
|
||||
LOG(DEBUG, LOG_TAG) << "Connect failed: " << ec.message() << "\n";
|
||||
wait(reconnect_timer_, 1s, [this] { connect(); });
|
||||
wait(reconnect_timer_, 1s, [this, self = shared_from_this()] { connect(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue