@@ -692,6 +692,7 @@ impl Node {
692692 }
693693
694694 log_info ! ( self . logger, "Shutting down LDK Node with node ID {}..." , self . node_id( ) ) ;
695+ println ! ( "[DEBUG stop] {} sending stop signal" , self . node_id( ) ) ;
695696
696697 // Stop background tasks.
697698 self . stop_sender
@@ -709,20 +710,27 @@ impl Node {
709710 } ) ;
710711
711712 // Cancel cancellable background tasks
713+ println ! ( "[DEBUG stop] {} aborting cancellable tasks" , self . node_id( ) ) ;
712714 self . runtime . abort_cancellable_background_tasks ( ) ;
713715
714716 // Disconnect all peers.
717+ println ! ( "[DEBUG stop] {} disconnecting peers" , self . node_id( ) ) ;
715718 self . peer_manager . disconnect_all_peers ( ) ;
716719 log_debug ! ( self . logger, "Disconnected all network peers." ) ;
717720
718721 // Wait until non-cancellable background tasks (mod LDK's background processor) are done.
722+ println ! ( "[DEBUG stop] {} waiting on background tasks" , self . node_id( ) ) ;
719723 self . runtime . wait_on_background_tasks ( ) ;
724+ println ! ( "[DEBUG stop] {} background tasks done" , self . node_id( ) ) ;
720725
721726 // Stop any runtime-dependant chain sources.
727+ println ! ( "[DEBUG stop] {} stopping chain source" , self . node_id( ) ) ;
722728 self . chain_source . stop ( ) ;
723729 log_debug ! ( self . logger, "Stopped chain sources." ) ;
730+ println ! ( "[DEBUG stop] {} chain source stopped" , self . node_id( ) ) ;
724731
725732 // Stop the background processor.
733+ println ! ( "[DEBUG stop] {} stopping background processor" , self . node_id( ) ) ;
726734 self . background_processor_stop_sender
727735 . send ( ( ) )
728736 . map ( |_| {
@@ -738,12 +746,15 @@ impl Node {
738746 } ) ;
739747
740748 // Finally, wait until background processing stopped, at least until a timeout is reached.
749+ println ! ( "[DEBUG stop] {} waiting on background processor" , self . node_id( ) ) ;
741750 self . runtime . wait_on_background_processor_task ( ) ;
751+ println ! ( "[DEBUG stop] {} background processor done" , self . node_id( ) ) ;
742752
743753 #[ cfg( tokio_unstable) ]
744754 self . runtime . log_metrics ( ) ;
745755
746756 log_info ! ( self . logger, "Shutdown complete." ) ;
757+ println ! ( "[DEBUG stop] {} shutdown complete" , self . node_id( ) ) ;
747758 * is_running_lock = false ;
748759 Ok ( ( ) )
749760 }
0 commit comments