mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-05-13 13:57:05 +00:00
daemon: Fix CloseService leaving instance non-nil on close error
This commit is contained in:
parent
a8e3cd3256
commit
ea464cef8d
1 changed files with 4 additions and 3 deletions
|
|
@ -226,13 +226,14 @@ func (s *StartedService) CloseService() error {
|
|||
return os.ErrInvalid
|
||||
}
|
||||
s.updateStatus(ServiceStatus_STOPPING)
|
||||
if s.instance != nil {
|
||||
err := s.instance.Close()
|
||||
instance := s.instance
|
||||
s.instance = nil
|
||||
if instance != nil {
|
||||
err := instance.Close()
|
||||
if err != nil {
|
||||
return s.updateStatusError(err)
|
||||
}
|
||||
}
|
||||
s.instance = nil
|
||||
s.startedAt = time.Time{}
|
||||
s.updateStatus(ServiceStatus_IDLE)
|
||||
s.serviceAccess.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue