@@ -64,7 +64,7 @@ use std::{
6464 sync:: { Arc , atomic:: AtomicBool } ,
6565} ;
6666use tokio:: {
67- runtime:: { self , Runtime } ,
67+ runtime:: { self , Handle , Runtime } ,
6868 sync:: mpsc,
6969 task,
7070} ;
@@ -323,7 +323,9 @@ impl Start {
323323 }
324324
325325 // Initialize the runtime.
326- Self :: runtime ( ) . block_on ( async move {
326+ let runtime = Self :: runtime ( ) ;
327+ let handle = runtime. handle ( ) . clone ( ) ;
328+ runtime. block_on ( async move {
327329 // Error messages.
328330 let node_parse_error = || "Failed to start node" ;
329331
@@ -332,9 +334,15 @@ impl Start {
332334
333335 // Parse the node arguments, start it, and block until shutdown.
334336 match self_. network {
335- MainnetV0 :: ID => self_. parse_node :: < MainnetV0 > ( log_receiver) . await . with_context ( node_parse_error) ?,
336- TestnetV0 :: ID => self_. parse_node :: < TestnetV0 > ( log_receiver) . await . with_context ( node_parse_error) ?,
337- CanaryV0 :: ID => self_. parse_node :: < CanaryV0 > ( log_receiver) . await . with_context ( node_parse_error) ?,
337+ MainnetV0 :: ID => {
338+ self_. parse_node :: < MainnetV0 > ( handle, log_receiver) . await . with_context ( node_parse_error) ?
339+ }
340+ TestnetV0 :: ID => {
341+ self_. parse_node :: < TestnetV0 > ( handle, log_receiver) . await . with_context ( node_parse_error) ?
342+ }
343+ CanaryV0 :: ID => {
344+ self_. parse_node :: < CanaryV0 > ( handle, log_receiver) . await . with_context ( node_parse_error) ?
345+ }
338346 _ => panic ! ( "Invalid network ID specified" ) ,
339347 } ;
340348
@@ -665,7 +673,7 @@ impl Start {
665673
666674 /// Start the node and blocks until it terminates.
667675 #[ rustfmt:: skip]
668- async fn parse_node < N : Network > ( & mut self , log_receiver : mpsc:: Receiver < Vec < u8 > > ) -> Result < ( ) > {
676+ async fn parse_node < N : Network > ( & mut self , handle : Handle , log_receiver : mpsc:: Receiver < Vec < u8 > > ) -> Result < ( ) > {
669677 if !self . nobanner {
670678 // Print the welcome banner.
671679 println ! ( "{}" , crate :: helpers:: welcome_message( ) ) ;
@@ -842,7 +850,7 @@ impl Start {
842850 }
843851
844852 // Register the signal handler.
845- let signal_handler = SignalHandler :: new ( ) ;
853+ let signal_handler = SignalHandler :: new ( Some ( handle ) ) ;
846854
847855 // Initialize the node.
848856 let node = match node_type {
0 commit comments