aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/abstract_tcp_server2.inl
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-12 07:25:01 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-18 23:34:01 +0100
commit1a526ed57181a837b20481d1b5d96f3713579d45 (patch)
treefe4379cf8d236069f5949d7b2e70687bb3ef28aa /contrib/epee/include/net/abstract_tcp_server2.inl
parentMerge pull request #3701 (diff)
downloadmonero-1a526ed57181a837b20481d1b5d96f3713579d45.tar.xz
abstract_tcp_server2: restart async accept on error
Diffstat (limited to 'contrib/epee/include/net/abstract_tcp_server2.inl')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl23
1 files changed, 19 insertions, 4 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 91a94c21e..0694d7baf 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -982,7 +982,8 @@ POP_WARNINGS
void boosted_tcp_server<t_protocol_handler>::handle_accept(const boost::system::error_code& e)
{
MDEBUG("handle_accept");
- TRY_ENTRY();
+ try
+ {
if (!e)
{
if (m_connection_type == e_connection_type_RPC) {
@@ -1000,11 +1001,25 @@ POP_WARNINGS
conn->start(true, 1 < m_threads_count);
conn->save_dbg_log();
- }else
+ return;
+ }
+ else
+ {
+ MERROR("Error in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e);
+ }
+ }
+ catch (const std::exception &e)
{
- _erro("Some problems at accept: " << e.message() << ", connections_count = " << m_sock_count);
+ MERROR("Exception in boosted_tcp_server<t_protocol_handler>::handle_accept: " << e.what());
}
- CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::handle_accept", void());
+
+ // 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>