mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
Throw error if server bind or listen fails (#309)
* Throw error if server bind or listen fails
This commit is contained in:
@@ -240,12 +240,22 @@ public:
|
|||||||
// Bind to the server address
|
// Bind to the server address
|
||||||
acceptor_.bind(endpoint, ec);
|
acceptor_.bind(endpoint, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
return;
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error)
|
||||||
|
<< "Failed to bind to endpoint: " << endpoint
|
||||||
|
<< ". message: " << ec.message();
|
||||||
|
throw std::runtime_error("Failed to bind to specified endpoint");
|
||||||
|
}
|
||||||
|
|
||||||
// Start listening for connections
|
// Start listening for connections
|
||||||
acceptor_.listen(net::socket_base::max_listen_connections, ec);
|
acceptor_.listen(net::socket_base::max_listen_connections, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
return;
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error)
|
||||||
|
<< "Failed to listen at endpoint: " << endpoint
|
||||||
|
<< ". message: " << ec.message();
|
||||||
|
throw std::runtime_error("Failed to listen at specified endpoint");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start accepting incoming connections
|
// Start accepting incoming connections
|
||||||
|
|||||||
Reference in New Issue
Block a user