mirror of
https://github.com/monero-project/monero.git
synced 2025-08-14 09:55:28 -04:00
Add check for exception in tcp accept handler
This commit is contained in:
parent
125622d5bd
commit
f567852867
1 changed files with 4 additions and 0 deletions
|
@ -1542,6 +1542,7 @@ namespace net_utils
|
||||||
accept_function_pointer = &boosted_tcp_server<t_protocol_handler>::handle_accept_ipv6;
|
accept_function_pointer = &boosted_tcp_server<t_protocol_handler>::handle_accept_ipv6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool accept_started = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!e)
|
if (!e)
|
||||||
|
@ -1562,6 +1563,7 @@ namespace net_utils
|
||||||
current_acceptor->async_accept((*current_new_connection)->socket(),
|
current_acceptor->async_accept((*current_new_connection)->socket(),
|
||||||
boost::bind(accept_function_pointer, this,
|
boost::bind(accept_function_pointer, this,
|
||||||
boost::asio::placeholders::error));
|
boost::asio::placeholders::error));
|
||||||
|
accept_started = true;
|
||||||
|
|
||||||
boost::asio::socket_base::keep_alive opt(true);
|
boost::asio::socket_base::keep_alive opt(true);
|
||||||
conn->socket().set_option(opt);
|
conn->socket().set_option(opt);
|
||||||
|
@ -1587,6 +1589,8 @@ namespace net_utils
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
|
MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
|
||||||
|
if (accept_started)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// error path, if e or exception
|
// error path, if e or exception
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue