Browse code

libnetwork: Controller: remove redundant mutex for diagnosticServer

diagnosticServer is only written to during controller.New, and the
diagnostic server itself already has a mutex on EnableDiagnostic,
DisableDiagnostic, and IsDiagnosticEnabled, which should prevent
issues trying to concurrently change its state.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2025/01/20 01:36:27
Showing 1 changed files
... ...
@@ -1093,21 +1093,15 @@ func (c *Controller) Stop() {
1093 1093
 
1094 1094
 // StartDiagnostic starts the network diagnostic server listening on port.
1095 1095
 func (c *Controller) StartDiagnostic(port int) {
1096
-	c.mu.Lock()
1097 1096
 	c.diagnosticServer.EnableDiagnostic("127.0.0.1", port)
1098
-	c.mu.Unlock()
1099 1097
 }
1100 1098
 
1101 1099
 // StopDiagnostic stops the network diagnostic server.
1102 1100
 func (c *Controller) StopDiagnostic() {
1103
-	c.mu.Lock()
1104 1101
 	c.diagnosticServer.DisableDiagnostic()
1105
-	c.mu.Unlock()
1106 1102
 }
1107 1103
 
1108 1104
 // IsDiagnosticEnabled returns true if the diagnostic server is running.
1109 1105
 func (c *Controller) IsDiagnosticEnabled() bool {
1110
-	c.mu.Lock()
1111
-	defer c.mu.Unlock()
1112 1106
 	return c.diagnosticServer.IsDiagnosticEnabled()
1113 1107
 }