[VOL-4442] grpc streaming connection monitoring
Change-Id: I6b26a29c74be8833e7262eb59d266e6cce66f0c3
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 7d6e9da..07e92d0 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -58,6 +58,7 @@
devicesLoadingLock sync.RWMutex
deviceLoadingInProgress map[string][]chan int
config *config.RWCoreFlags
+ doneCh chan struct{}
}
//NewManagers creates the Manager and the Logical Manager.
@@ -74,6 +75,7 @@
Agent: event.NewAgent(eventProxy, coreInstanceID, cf.VolthaStackID),
deviceLoadingInProgress: make(map[string][]chan int),
config: cf,
+ doneCh: make(chan struct{}),
}
deviceMgr.stateTransitions = state.NewTransitionMap(deviceMgr)
@@ -128,6 +130,12 @@
return nil
}
+func (dMgr *Manager) Stop(ctx context.Context, serviceName string) {
+ logger.Info(ctx, "stopping-device-manager")
+ close(dMgr.doneCh)
+ probe.UpdateStatusFromContext(ctx, serviceName, probe.ServiceStatusStopped)
+}
+
func (dMgr *Manager) addDeviceAgentToMap(agent *Agent) {
if _, exist := dMgr.deviceAgents.Load(agent.deviceID); !exist {
dMgr.deviceAgents.Store(agent.deviceID, agent)