The flow and mcast handler channels should be unbuffered to make
them to be blocking
Change-Id: I37982f296406026c5ebcdcd9361acf8575c25f2a
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 86cce43..7ecffed 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -189,13 +189,13 @@
cloned := (proto.Clone(device)).(*voltha.Device)
dh.device = cloned
dh.openOLT = adapter
- dh.exitChannel = make(chan int, 1)
+ dh.exitChannel = make(chan int, 1) // TODO: Why buffered?
dh.lockDevice = sync.RWMutex{}
- dh.stopCollector = make(chan bool, 2)
- dh.stopHeartbeatCheck = make(chan bool, 2)
+ dh.stopCollector = make(chan bool, 2) // TODO: Why buffered?
+ dh.stopHeartbeatCheck = make(chan bool, 2) // TODO: Why buffered?
dh.metrics = pmmetrics.NewPmMetrics(cloned.Id, pmmetrics.Frequency(150), pmmetrics.FrequencyOverride(false), pmmetrics.Grouped(false), pmmetrics.Metrics(pmNames))
dh.activePorts = sync.Map{}
- dh.stopIndications = make(chan bool, 1)
+ dh.stopIndications = make(chan bool, 1) // TODO: Why buffered?
dh.perPonOnuIndicationChannel = make(map[uint32]onuIndicationChannels)
dh.childAdapterClients = make(map[string]*vgrpc.Client)
dh.cfg = cfg
@@ -205,7 +205,7 @@
dh.mcastHandlerRoutineActive = make([]bool, MaxNumOfGroupHandlerChannels)
for i := range dh.incomingMcastFlowOrGroup {
dh.incomingMcastFlowOrGroup[i] = make(chan McastFlowOrGroupControlBlock, MaxNumOfGroupHandlerChannels)
- dh.stopMcastHandlerRoutine[i] = make(chan bool, 1)
+ dh.stopMcastHandlerRoutine[i] = make(chan bool)
// Spin up a go routine to handling incoming mcast flow/group (add/modify/remove).
// There will be MaxNumOfGroupHandlerChannels number of mcastFlowOrGroupChannelHandlerRoutine go routines.
// These routines will be blocked on the dh.incomingMcastFlowOrGroup[mcast-group-id modulo MaxNumOfGroupHandlerChannels] channel
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index be74049..7c3681e 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -250,7 +250,7 @@
flowMgr.flowHandlerRoutineActive = make([]bool, plt.MaxOnusPerPon+1)
for i := range flowMgr.incomingFlows {
flowMgr.incomingFlows[i] = make(chan flowControlBlock, maxConcurrentFlowsPerOnu)
- flowMgr.stopFlowHandlerRoutine[i] = make(chan bool, 1)
+ flowMgr.stopFlowHandlerRoutine[i] = make(chan bool)
// Spin up a go routine to handling incoming flows (add/remove).
// There will be on go routine per ONU.
// This routine will be blocked on the flowMgr.incomingFlows[onu-id] channel for incoming flows.