aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl27
-rw-r--r--contrib/epee/src/memwipe.c8
2 files changed, 26 insertions, 9 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 134bb4199..5b3550005 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -653,13 +653,13 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_timer.cancel();
boost::system::error_code ignored_ec;
socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
- m_was_shutdown = true;
- m_protocol_handler.release_protocol();
if (!m_host.empty())
{
try { host_count(m_host, -1); } catch (...) { /* ignore */ }
m_host = "";
}
+ m_was_shutdown = true;
+ m_protocol_handler.release_protocol();
return true;
}
//---------------------------------------------------------------------------------
@@ -1030,7 +1030,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) {
@@ -1048,11 +1049,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>
diff --git a/contrib/epee/src/memwipe.c b/contrib/epee/src/memwipe.c
index e3a2f76c8..c2a26c392 100644
--- a/contrib/epee/src/memwipe.c
+++ b/contrib/epee/src/memwipe.c
@@ -50,7 +50,7 @@
void *memwipe(void *ptr, size_t n)
{
- if (memset_s(ptr, n, 0, n))
+ if (n > 0 && memset_s(ptr, n, 0, n))
{
#ifdef NDEBUG
fprintf(stderr, "Error: memset_s failed\n");
@@ -67,7 +67,8 @@ void *memwipe(void *ptr, size_t n)
void *memwipe(void *ptr, size_t n)
{
- explicit_bzero(ptr, n);
+ if (n > 0)
+ explicit_bzero(ptr, n);
SCARECROW
return ptr;
}
@@ -105,7 +106,8 @@ static void memory_cleanse(void *ptr, size_t len)
void *memwipe(void *ptr, size_t n)
{
- memory_cleanse(ptr, n);
+ if (n > 0)
+ memory_cleanse(ptr, n);
SCARECROW
return ptr;
}