aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.inl
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-12-04 22:27:41 +0200
committerRiccardo Spagni <ric@spagni.net>2016-12-04 22:27:41 +0200
commit80863796807ecd524f4a76964b2d58167f819e26 (patch)
tree4430f9061380e9ae62eeb313e8ccb19aa8e70c4c /src/cryptonote_protocol/cryptonote_protocol_handler.inl
parentMerge pull request #1396 (diff)
parentFix delayed exit when syncing (diff)
downloadmonero-80863796807ecd524f4a76964b2d58167f819e26.tar.xz
Merge pull request #1397
3f7d6fb5 Fix delayed exit when syncing (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_protocol/cryptonote_protocol_handler.inl')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 35266fc7c..51ade0221 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -60,7 +60,8 @@ namespace cryptonote
t_cryptonote_protocol_handler<t_core>::t_cryptonote_protocol_handler(t_core& rcore, nodetool::i_p2p_endpoint<connection_context>* p_net_layout):m_core(rcore),
m_p2p(p_net_layout),
m_syncronized_connections_count(0),
- m_synchronized(false)
+ m_synchronized(false),
+ m_stopping(false)
{
if(!m_p2p)
@@ -793,6 +794,11 @@ namespace cryptonote
size_t count = 0;
BOOST_FOREACH(const block_complete_entry& block_entry, arg.blocks)
{
+ if (m_stopping)
+ {
+ return 1;
+ }
+
++count;
block b;
if(!parse_and_validate_block_from_blob(block_entry.block, b))
@@ -857,6 +863,12 @@ namespace cryptonote
m_core.prepare_handle_incoming_blocks(arg.blocks);
BOOST_FOREACH(const block_complete_entry& block_entry, arg.blocks)
{
+ if (m_stopping)
+ {
+ m_core.cleanup_handle_incoming_blocks();
+ return 1;
+ }
+
// process transactions
TIME_MEASURE_START(transactions_process_time);
BOOST_FOREACH(auto& tx_blob, block_entry.txs)
@@ -1146,5 +1158,11 @@ namespace cryptonote
(*logreq) << "log used" << std::endl;
return *logreq;
}
-
+ //------------------------------------------------------------------------------------------------------------------------
+ template<class t_core>
+ void t_cryptonote_protocol_handler<t_core>::stop()
+ {
+ m_stopping = true;
+ m_core.stop();
+ }
} // namespace