From 3dad490fcf3b84c6453da0f93d012185fd8027a3 Mon Sep 17 00:00:00 2001 From: Maximilian Stinsky Date: Wed, 4 May 2022 11:24:03 +0200 Subject: [PATCH] Check if dumpPortsPrefix is shown again to continue the loop --- ovs/openflow.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ovs/openflow.go b/ovs/openflow.go index 17458e4..9300571 100644 --- a/ovs/openflow.go +++ b/ovs/openflow.go @@ -431,6 +431,13 @@ func parseEach(in []byte, prefix []byte, fn func(b []byte) error) error { // Scan every two lines to retrieve information needed to unmarshal // a single PortStats struct. for scanner.Scan() { + + // After 630 ports the DumpPortsPrefix is shown again. + // Detect here to discover if we need to continue the loop. + if bytes.HasPrefix(scanner.Bytes(), prefix) { + continue + } + b := make([]byte, len(scanner.Bytes())) copy(b, scanner.Bytes())