aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsserver/apiv1-exec.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsserver/apiv1-exec.go')
-rw-r--r--lib/xdsserver/apiv1-exec.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/xdsserver/apiv1-exec.go b/lib/xdsserver/apiv1-exec.go
index 57ea1f1..c045e9e 100644
--- a/lib/xdsserver/apiv1-exec.go
+++ b/lib/xdsserver/apiv1-exec.go
@@ -314,6 +314,9 @@ func (s *APIService) execCmd(c *gin.Context) {
if errSoEmit != nil {
s.Log.Errorf("WS Emit : %v", errSoEmit)
}
+ s.lock.Lock()
+ s.lock.LockCpt--
+ s.lock.Unlock()
}
// User data (used within callbacks)
@@ -330,8 +333,14 @@ func (s *APIService) execCmd(c *gin.Context) {
// Start command execution
s.Log.Infof("Execute [Cmd ID %s]: %v %v", execWS.CmdID, execWS.Cmd, execWS.Args)
+ s.lock.Lock()
+ s.lock.LockCpt++
+ s.lock.Unlock()
err = execWS.Start()
if err != nil {
+ s.lock.Lock()
+ s.lock.LockCpt--
+ s.lock.Unlock()
common.APIError(c, err.Error())
return
}