mirror of
https://github.com/moby/moby.git
synced 2026-08-08 09:01:44 +00:00
libnetwork/diagnostic: make DisableDiagnostic idempotent
Handle situations where the server is already stopped internally, instead of requiring the caller to do this. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -105,6 +105,9 @@ func (s *Server) EnableDiagnostic(ip string, port int) {
|
||||
func (s *Server) DisableDiagnostic() {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if !s.enable {
|
||||
return
|
||||
}
|
||||
|
||||
s.srv.Shutdown(context.Background()) //nolint:errcheck
|
||||
s.srv = nil
|
||||
|
||||
Reference in New Issue
Block a user