summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-06-04 16:28:18 -0700
committerDave Wallace <dwallacelf@gmail.com>2021-06-07 21:31:53 +0000
commite9b33fcbde7552c443acb957e0f1278636b78408 (patch)
tree3e544657c7e96a79b98a3d0b7de624c04694c0f1 /src
parentb635851ee252d1b95bdf5ef5dfc8dbafd28708ab (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 (cherry picked from commit 233683180638d1c7f517b713722cbbeb3b4be86e)
Diffstat (limited to 'src')
-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 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))