Skip to content

Agent Mesh

Update mobile/sam-node-ffi/ffi/ffi.go

ibrahim61f5cf36fed0
diff --git a/mobile/sam-node-ffi/ffi/ffi.go b/mobile/sam-node-ffi/ffi/ffi.go
index cc7f0ca3..b28f2a9d 100644
--- a/mobile/sam-node-ffi/ffi/ffi.go
+++ b/mobile/sam-node-ffi/ffi/ffi.go
@@ -546,8 +546,9 @@ func saveRefreshSession(ctx context.Context, store *node.Store, controlPlaneURL,
// no token was saved or it expired; the app then falls back to the browser.
func ReEnrollNode(dataDir string, labels string) error {
mu.Lock()
- defer mu.Unlock()
- if activeNode != nil || unauthSrv != nil {
+ isRunning := activeNode != nil || unauthSrv != nil
+ mu.Unlock()
+ if isRunning {
return errors.New("stop the node before re-enrolling")
}
parsedLabels, err := decodeLabels(labels)