From e9b33fcbde7552c443acb957e0f1278636b78408 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 4 Jun 2021 16:28:18 -0700 Subject: vcl: avoid multiple reads on peek Only try once and return what was found. Type: fix Signed-off-by: Florin Coras Change-Id: I50b1d26babf1b7431d36f6b7472a1fb01475bb35 (cherry picked from commit 233683180638d1c7f517b713722cbbeb3b4be86e) --- src/vcl/vppcom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index ebc9e768b0c..0c6f6e6bbfd 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1987,6 +1987,10 @@ read_again: rv = app_recv_stream_raw (rx_fifo, buf, n, 0, peek); ASSERT (rv >= 0); + + if (peek) + return rv; + n_read += rv; if (svm_fifo_is_empty_cons (rx_fifo)) -- cgit 1.2.3-korg