diff --git a/eth/backend.go b/eth/backend.go index af66653fd..54e6bbd8d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -849,7 +849,16 @@ func (s *Ethereum) Stop() error { // Stop all the peer-related stuff first. s.protocolManager.Stop() if s.privateAPI != nil { - s.privateAPI.GracefulStop() + shutdownDone := make(chan bool) + go func() { + defer close(shutdownDone) + s.privateAPI.GracefulStop() + }() + select { + case <-time.After(1 * time.Second): // shutdown deadline + s.privateAPI.Stop() + case <-shutdownDone: + } } // Then stop everything else.