Code Review
/
src
/
xds
/
xds-server.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add gitlab issue/merge request templates
[src/xds/xds-server.git]
/
lib
/
xdsserver
/
apiv1-sdks.go
diff --git
a/lib/xdsserver/apiv1-sdks.go
b/lib/xdsserver/apiv1-sdks.go
index
e69b82d
..
58154ab
100644
(file)
--- a/
lib/xdsserver/apiv1-sdks.go
+++ b/
lib/xdsserver/apiv1-sdks.go
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2017 "IoT.bzh"
+ * Copyright (C) 2017
-2018
"IoT.bzh"
* Author Sebastien Douheret <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Author Sebastien Douheret <sebastien@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@
-20,9
+20,9
@@
package xdsserver
import (
"net/http"
import (
"net/http"
+ common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xsapiv1"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
- common "github.com/iotbzh/xds-common/golib"
- "github.com/iotbzh/xds-server/lib/xsapiv1"
)
// getSdks returns all SDKs configuration
)
// getSdks returns all SDKs configuration
@@
-74,8
+74,13
@@
func (s *APIService) installSdk(c *gin.Context) {
return
}
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 {
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
}
common.APIError(c, err.Error())
return
}
@@
-103,6
+108,7
@@
func (s *APIService) abortInstallSdk(c *gin.Context) {
return
}
return
}
+ LockXdsUpdateCounter(s.Context, false)
c.JSON(http.StatusOK, sdk)
}
c.JSON(http.StatusOK, sdk)
}
@@
-123,10
+129,12
@@
func (s *APIService) removeSdk(c *gin.Context) {
s.Log.Debugln("Remove SDK id ", id)
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
}
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)
}
c.JSON(http.StatusOK, delEntry)
}