mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-27 06:57:03 +02:00
Use helper function for async_wait
PosixStream waits 100ms before reconnecting
This commit is contained in:
parent
5c79d9447d
commit
9353c61d7b
5 changed files with 36 additions and 68 deletions
|
@ -98,11 +98,7 @@ void TcpStream::do_connect()
|
|||
else
|
||||
{
|
||||
LOG(DEBUG) << "Connect failed: " << ec.message() << "\n";
|
||||
reconnect_timer_.expires_after(std::chrono::milliseconds(1000));
|
||||
reconnect_timer_.async_wait([self, this](const boost::system::error_code& ec) {
|
||||
if (!ec)
|
||||
connect();
|
||||
});
|
||||
wait(reconnect_timer_, 1s, [this] { connect(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -117,4 +113,4 @@ void TcpStream::do_disconnect()
|
|||
acceptor_->cancel();
|
||||
reconnect_timer_.cancel();
|
||||
}
|
||||
}
|
||||
} // namespace streamreader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue