aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-06-04 16:28:18 -0700
committerDave Barach <openvpp@barachs.net>2021-06-07 15:24:21 +0000
commit233683180638d1c7f517b713722cbbeb3b4be86e (patch)
tree11d230519c859267d3b964fb02d399cc58847de5 /src/vcl
parent778b3186fc911af2aabbbfbf56bc1df5e2373061 (diff)
vcl: avoid multiple reads on peek
Only try once and return what was found. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I50b1d26babf1b7431d36f6b7472a1fb01475bb35
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vppcom.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index e98f9b7c84a..4c77b0bc43b 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))