mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
abstract_tcp_server2: restart async accept on error
This commit is contained in:
parent
62f3f0480a
commit
1a526ed571
1 changed files with 20 additions and 5 deletions
|
@ -982,7 +982,8 @@ POP_WARNINGS
|
||||||
void boosted_tcp_server<t_protocol_handler>::handle_accept(const boost::system::error_code& e)
|
void boosted_tcp_server<t_protocol_handler>::handle_accept(const boost::system::error_code& e)
|
||||||
{
|
{
|
||||||
MDEBUG("handle_accept");
|
MDEBUG("handle_accept");
|
||||||
TRY_ENTRY();
|
try
|
||||||
|
{
|
||||||
if (!e)
|
if (!e)
|
||||||
{
|
{
|
||||||
if (m_connection_type == e_connection_type_RPC) {
|
if (m_connection_type == e_connection_type_RPC) {
|
||||||
|
@ -1000,11 +1001,25 @@ POP_WARNINGS
|
||||||
|
|
||||||
conn->start(true, 1 < m_threads_count);
|
conn->start(true, 1 < m_threads_count);
|
||||||
conn->save_dbg_log();
|
conn->save_dbg_log();
|
||||||
}else
|
return;
|
||||||
{
|
|
||||||
_erro("Some problems at accept: " << e.message() << ", connections_count = " << m_sock_count);
|
|
||||||
}
|
}
|
||||||
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::handle_accept", void());
|
else
|
||||||
|
{
|
||||||
|
MERROR("Error in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
// error path, if e or exception
|
||||||
|
_erro("Some problems at accept: " << e.message() << ", connections_count = " << m_sock_count);
|
||||||
|
misc_utils::sleep_no_w(100);
|
||||||
|
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
|
||||||
|
acceptor_.async_accept(new_connection_->socket(),
|
||||||
|
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
|
||||||
|
boost::asio::placeholders::error));
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
|
|
Loading…
Reference in a new issue