[client] Always restore Idle on Down despite engine.Stop failure

Log engine.Stop() errors during cleanupConnection instead of returning
early, so beginDown always reaches finishDown and the daemon is restored
to Idle. Return ErrServiceNotUp without an error log.
This commit is contained in:
Zoltán Papp
2026-07-16 11:31:45 +02:00
parent 48124f8099
commit 2f4086f836

View File

@@ -1099,7 +1099,9 @@ func (s *Server) beginDown() (chan struct{}, error) {
giveUpChan := s.clientGiveUpChan
if err := s.cleanupConnection(); err != nil {
// todo review to update the status in case any type of error
if errors.Is(err, ErrServiceNotUp) {
return nil, err
}
log.Errorf("failed to shut down properly: %v", err)
return nil, err
}
@@ -1172,7 +1174,7 @@ func (s *Server) cleanupConnection() error {
// making the run loop the sole owner of engine shutdown.
if engine != nil {
if err := engine.Stop(); err != nil {
return err
log.Errorf("failed to stop engine during cleanup: %v", err)
}
}