[VOL-1889] Packet Out fix
Change-Id: I84850e1dfaa58d7e5e0ed46d8344e90dcce8e030
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index bdb3e39..8cc1dc4 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -788,13 +788,25 @@
packets voltha.VolthaService_StreamPacketsOutServer,
) error {
log.Debugw("StreamPacketsOut-request", log.Fields{"packets": packets})
+loop:
for {
+ select {
+ case <-packets.Context().Done():
+ log.Infow("StreamPacketsOut-context-done", log.Fields{"packets": packets, "error": packets.Context().Err()})
+ break loop
+ default:
+ }
+
packet, err := packets.Recv()
if err == io.EOF {
- break
- } else if err != nil {
- log.Errorw("Failed to receive packet", log.Fields{"error": err})
+ log.Debugw("Received-EOF", log.Fields{"packets": packets})
+ break loop
+ }
+
+ if err != nil {
+ log.Errorw("Failed to receive packet out", log.Fields{"error": err})
+ continue
}
handler.forwardPacketOut(packet)