From: Carl Smith Date: Tue, 12 Nov 2019 01:57:37 +0000 (+1300) Subject: vcl: fix nonblocking accept with >1 event in the queue X-Git-Tag: v19.08.2~70 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=c48306407b070760a95ad1dbb349845e07dd3231;p=vpp.git vcl: fix nonblocking accept with >1 event in the queue We discard unwanted events until we get an ACCEPTED. But if we are non-blocking we need to check the queue length every time and EAGAIN if empty before waiting. Type: fix Signed-off-by: Carl Smith Change-Id: Ie0c7e5cb00f0d37d2e1534f8bb384221ff56f2e3 (cherry picked from commit 592a909a302262cf4088a5468b8e427f577725e8) --- diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 349e27e5122..263fa916231 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1464,11 +1464,11 @@ vppcom_session_accept (uint32_t listen_session_handle, vppcom_endpt_t * ep, is_nonblocking = VCL_SESS_ATTR_TEST (listen_session->attr, VCL_SESS_ATTR_NONBLOCK); - if (svm_msg_q_is_empty (wrk->app_event_queue) && is_nonblocking) - return VPPCOM_EAGAIN; - while (1) { + if (svm_msg_q_is_empty (wrk->app_event_queue) && is_nonblocking) + return VPPCOM_EAGAIN; + if (svm_msg_q_sub (wrk->app_event_queue, &msg, SVM_Q_WAIT, 0)) return VPPCOM_EAGAIN;