aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsserver/apiv1-sdks.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsserver/apiv1-sdks.go')
-rw-r--r--lib/xdsserver/apiv1-sdks.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/xdsserver/apiv1-sdks.go b/lib/xdsserver/apiv1-sdks.go
index 7bb9767..a943da5 100644
--- a/lib/xdsserver/apiv1-sdks.go
+++ b/lib/xdsserver/apiv1-sdks.go
@@ -74,8 +74,13 @@ func (s *APIService) installSdk(c *gin.Context) {
return
}
+ //increment lock xds counter: it will be decremented,
+ //when SDK is installed in file sdk.go in function ExitCB
+ //at line 308 or when install is aborted in following function
+ LockXdsUpdateCounter(s.Context, true)
sdk, err := s.sdks.Install(id, args.Filename, args.Force, args.Timeout, args.InstallArgs, sess)
if err != nil {
+ LockXdsUpdateCounter(s.Context, false)
common.APIError(c, err.Error())
return
}
@@ -103,6 +108,7 @@ func (s *APIService) abortInstallSdk(c *gin.Context) {
return
}
+ LockXdsUpdateCounter(s.Context, false)
c.JSON(http.StatusOK, sdk)
}
@@ -123,10 +129,12 @@ func (s *APIService) removeSdk(c *gin.Context) {
s.Log.Debugln("Remove SDK id ", id)
+ LockXdsUpdateCounter(s.Context, true)
delEntry, err := s.sdks.Remove(id, -1, sess)
if err != nil {
common.APIError(c, err.Error())
return
}
+ LockXdsUpdateCounter(s.Context, false)
c.JSON(http.StatusOK, delEntry)
}