diff options
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/brew/Brewfile | 1 | ||||
| -rw-r--r-- | contrib/epee/include/misc_log_ex.h | 11 | ||||
| -rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 17 |
3 files changed, 24 insertions, 5 deletions
diff --git a/contrib/brew/Brewfile b/contrib/brew/Brewfile index c74e7b2a2..3697898f5 100644 --- a/contrib/brew/Brewfile +++ b/contrib/brew/Brewfile @@ -23,7 +23,6 @@ brew "zmq" brew "libpgm" brew "unbound" brew "libsodium" -brew "miniupnpc" brew "readline" brew "expat" brew "ccache" diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index 701f8f102..7350d84f4 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -172,6 +172,17 @@ namespace debug return return_val; \ } +#define CATCH_ENTRY_SWALLOW_EX(location) } \ + catch(const std::exception& ex) \ +{ \ + (void)(ex); \ + LOG_ERROR("Exception at [" << location << "], what=" << ex.what()); \ +}\ + catch(...)\ +{\ + LOG_ERROR("Exception at [" << location << "], generic exception \"...\"");\ +} + #define CATCH_ENTRY_L0(lacation, return_val) CATCH_ENTRY(lacation, return_val) #define CATCH_ENTRY_L1(lacation, return_val) CATCH_ENTRY(lacation, return_val) #define CATCH_ENTRY_L2(lacation, return_val) CATCH_ENTRY(lacation, return_val) diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 60cc1b55f..e202d9152 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -423,10 +423,13 @@ namespace net_utils boost::asio::post( connection_basic::strand_, [this, self, bytes_transferred]{ - bool success = m_handler.handle_recv( + bool success = false; + TRY_ENTRY(); + success = m_handler.handle_recv( reinterpret_cast<char *>(m_state.data.read.buffer.data()), bytes_transferred ); + CATCH_ENTRY_SWALLOW_EX("m_handler.handle_recv"); std::lock_guard<std::mutex> guard(m_state.lock); const bool error_status = m_state.status == status_t::INTERRUPTED || m_state.status == status_t::TERMINATING @@ -1150,17 +1153,21 @@ namespace net_utils // execute terminate inside m_strand. So we wait for the connection's shutdown sequence to complete before stopping // the io_context. MDEBUG("Waiting for connection " << m_conn_context.m_connection_id << " to shutdown, current state: " << m_state.status); - m_state.condition.wait( + const bool shutdown = m_state.condition.wait_for( m_state.lock, + std::chrono::seconds(5), [this]{ return ( m_state.status == status_t::TERMINATED || m_state.status == status_t::WASTED ); } ); - MDEBUG("Shut down connection " << m_conn_context.m_connection_id); + if (shutdown) + MDEBUG("Shut down connection " << m_conn_context.m_connection_id); + else + MERROR("Connection " << m_conn_context.m_connection_id << " did not shut down"); - return true; + return shutdown; } template<typename T> @@ -1186,7 +1193,9 @@ namespace net_utils auto self = connection<T>::shared_from_this(); ++m_state.protocol.wait_callback; boost::asio::post(connection_basic::strand_, [this, self]{ + TRY_ENTRY(); m_handler.handle_qued_callback(); + CATCH_ENTRY_SWALLOW_EX("m_handler.handle_qued_callback"); std::lock_guard<std::mutex> guard(m_state.lock); --m_state.protocol.wait_callback; if (m_state.status == status_t::INTERRUPTED) |
