diff options
| author | Lee *!* Clagett <code@leeclagett.com> | 2025-06-12 17:46:42 -0400 |
|---|---|---|
| committer | Lee *!* Clagett <code@leeclagett.com> | 2025-06-12 17:48:49 -0400 |
| commit | 9f3d96eba6cc56d1ed6609cc7927c3561e789a3b (patch) | |
| tree | f7efd0b997045f6b1bf2a7d9f950fe33c18d0b56 | |
| parent | df765433699ee53f4ee0fef1b3991ab14e9f2267 (diff) | |
| download | monzero-core-9f3d96eba6cc56d1ed6609cc7927c3561e789a3b.tar.gz monzero-core-9f3d96eba6cc56d1ed6609cc7927c3561e789a3b.tar.xz monzero-core-9f3d96eba6cc56d1ed6609cc7927c3561e789a3b.zip | |
Add check for exception in tcp accept handler
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 7c671d0e4..bc1f801a4 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -1540,6 +1540,7 @@ namespace net_utils accept_function_pointer = &boosted_tcp_server<t_protocol_handler>::handle_accept_ipv6; } + bool accept_started = false; try { if (!e) @@ -1560,6 +1561,7 @@ namespace net_utils current_acceptor->async_accept((*current_new_connection)->socket(), boost::bind(accept_function_pointer, this, boost::asio::placeholders::error)); + accept_started = true; boost::asio::socket_base::keep_alive opt(true); conn->socket().set_option(opt); @@ -1585,6 +1587,8 @@ namespace net_utils catch (const std::exception &e) { MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what()); + if (accept_started) + return; } // error path, if e or exception |
