File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,9 +374,20 @@ impl CbfChainSource {
374374 event_rx : new_event_rx,
375375 } = new_client;
376376
377- // Swap the requester so callers pick up the new handle.
378- * restart_status. lock ( ) . expect ( "lock" ) =
379- CbfRuntimeStatus :: Started { requester : new_requester } ;
377+ // Publish the new requester only if stop() did not fire during the
378+ // backoff sleep. Otherwise the rebuilt node would outlive stop().
379+ {
380+ let mut status = restart_status. lock ( ) . expect ( "lock" ) ;
381+ if matches ! ( * status, CbfRuntimeStatus :: Stopped ) {
382+ let _ = new_requester. shutdown ( ) ;
383+ log_info ! (
384+ restart_logger,
385+ "CBF restart aborted: stop() called during backoff."
386+ ) ;
387+ break ;
388+ }
389+ * status = CbfRuntimeStatus :: Started { requester : new_requester } ;
390+ }
380391
381392 current_node = new_node;
382393 current_info_rx = new_info_rx;
You can’t perform that action at this time.
0 commit comments