mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 21:50:25 +00:00
Fix graceful shutdown
Don't instantly shut down server in response to accept failure when not accepting connections.
This commit is contained in:
parent
2888f0417d
commit
b55a33fd2b
@ -116,13 +116,15 @@ void server_base::serve(boost::asio::yield_context yield, boost::asio::ip::tcp::
|
||||
|
||||
boost::system::error_code error;
|
||||
acceptor.async_accept(socket->lowest_layer(), yield[error]);
|
||||
if(error) {
|
||||
if(error && accepting_connections()) {
|
||||
ERR_SERVER << "Accept failed: " << error.message() << "\n";
|
||||
BOOST_THROW_EXCEPTION(server_shutdown("Accept failed", error));
|
||||
}
|
||||
|
||||
if(accepting_connections()) {
|
||||
boost::asio::spawn(io_service_, [this, &acceptor, endpoint](boost::asio::yield_context yield) { serve(yield, acceptor, endpoint); });
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
|
Loading…
x
Reference in New Issue
Block a user