From 928c1825f09d840a73d75889a21a68871e8f3164 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 2 Feb 2018 22:33:53 +0000 Subject: cryptonote_protocol: guard against all threads in standby --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index bc11ab6e4..e14040299 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1333,6 +1333,15 @@ skip: break; } + // this one triggers if all threads are in standby, which should not happen, + // but happened at least once, so we unblock at least one thread if so + const boost::unique_lock sync{m_sync_lock, boost::try_to_lock}; + if (sync.owns_lock()) + { + LOG_DEBUG_CC(context, "No other thread is adding blocks, resuming"); + break; + } + if (should_download_next_span(context)) { MDEBUG(context << " we should try for that next span too, we think we could get it faster, resuming"); -- cgit v1.2.3