[VOL-4137] Receiving logical device deletion event from rw-core for immediate disconnection from ONOS
Change-Id: I82a4c2995dc76066fc4f2ed6908996e6f9194c3b
diff --git a/internal/pkg/openflow/client.go b/internal/pkg/openflow/client.go
index 9097444..1785d35 100644
--- a/internal/pkg/openflow/client.go
+++ b/internal/pkg/openflow/client.go
@@ -219,6 +219,11 @@
// Stop initiates a shutdown of the OFClient
func (ofc *OFClient) Stop() {
for _, connection := range ofc.connections {
+ for len(connection.sendChannel) > 0 || connection.lastUnsentMessage != nil {
+ logger.Debugw(context.Background(), "waiting for channel to be empty before closing", log.Fields{
+ "len": connection.sendChannel})
+ //do nothing, waiting for the channel to send the messages
+ }
connection.events <- ofcEventStop
}
}