@@ -482,7 +482,7 @@ void chain_plugin_impl::start_write_processing()
482482 }
483483 } );
484484 {
485- std::unique_lock <std::mutex> _guard (this_->finish .mtx );
485+ std::lock_guard <std::mutex> _guard (this_->finish .mtx );
486486 this_->finish .status = true ;
487487 }
488488 // / Notify waiting (main-thread) that starting shutdown procedure is allowed, since main-writer thread activity finished.
@@ -580,6 +580,8 @@ void chain_plugin_impl::start_write_processing()
580580
581581 if (!is_running ()) // we woke because the node is shutting down
582582 {
583+ std::lock_guard<std::mutex> _guard (finish.mtx );
584+ finish.status = true ;
583585 if ( priority_write_queue.empty () && write_queue.empty () )
584586 break ;
585587 }
@@ -1960,7 +1962,7 @@ bool chain_plugin::accept_block( const std::shared_ptr< p2p_block_flow_control >
19601962 fc::future<void > accept_block_future (accept_block_promise);
19611963 block_ctrl->attach_promise ( accept_block_promise );
19621964 my->add_to_priority_write_queue ( &cxt, accept_block_promise );
1963- if ( my-> theApp . is_interrupt_request () )
1965+ if ( is_finished_write_processing () )
19641966 FC_THROW_EXCEPTION ( fc::canceled_exception, " Interrupt request occured during a block accepting" );
19651967 else
19661968 accept_block_future.wait ();
@@ -1989,7 +1991,7 @@ void chain_plugin::accept_transaction( const std::shared_ptr<full_transaction_ty
19891991 boost::unique_future<void > accept_transaction_future (accept_transaction_promise->get_future ());
19901992 tx_ctrl.attach_promise ( accept_transaction_promise );
19911993 my->add_to_write_queue ( &cxt, accept_transaction_promise );
1992- if ( my-> theApp . is_interrupt_request () )
1994+ if ( is_finished_write_processing () )
19931995 FC_THROW_EXCEPTION ( fc::canceled_exception, " Interrupt request occured a transaction accepting" );
19941996 else
19951997 accept_transaction_future.get ();
@@ -2001,7 +2003,7 @@ void chain_plugin::accept_transaction( const std::shared_ptr<full_transaction_ty
20012003 fc::future<void > accept_transaction_future (accept_transaction_promise);
20022004 tx_ctrl.attach_promise ( accept_transaction_promise );
20032005 my->add_to_write_queue ( &cxt, accept_transaction_promise );
2004- if ( my-> theApp . is_interrupt_request () )
2006+ if ( is_finished_write_processing () )
20052007 FC_THROW_EXCEPTION ( fc::canceled_exception, " Interrupt request occured a transaction accepting" );
20062008 else
20072009 accept_transaction_future.wait ();
@@ -2063,7 +2065,7 @@ void chain_plugin::push_generate_block_request( const std::shared_ptr< generate_
20632065 boost::unique_future<void > generate_block_future (generate_block_promise->get_future ());
20642066 generate_block_ctrl->attach_promise ( generate_block_promise );
20652067 my->add_to_priority_write_queue ( &cxt, generate_block_promise );
2066- if ( my-> theApp . is_interrupt_request () )
2068+ if ( is_finished_write_processing () )
20672069 FC_THROW_EXCEPTION ( fc::canceled_exception, " Interrupt request occured during a block generation" );
20682070 else
20692071 generate_block_future.get ();
@@ -2079,7 +2081,7 @@ void chain_plugin::queue_generate_block_request( const std::shared_ptr< generate
20792081 std::shared_ptr<boost::promise<void >> generate_block_promise = std::make_shared<boost::promise<void >>();
20802082 generate_block_ctrl->attach_promise ( generate_block_promise );
20812083 my->add_to_priority_write_queue ( &cxt, generate_block_promise );
2082- if ( my-> theApp . is_interrupt_request () )
2084+ if ( is_finished_write_processing () )
20832085 FC_THROW_EXCEPTION ( fc::canceled_exception, " Interrupt request occured during a block generation" );
20842086}
20852087
0 commit comments