X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvcl%2Fvppcom.c;h=0bbdea549403cb84441642022dfb9a2870677016;hb=87d24db65facb89ca524c951b8379ca2ec4dbc7a;hp=47ea7a479b1ee1f91938bafc22b18254c6e0d281;hpb=bd52e46fe8193182cce150292e9df1c517795011;p=vpp.git diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 47ea7a479b1..0bbdea54940 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; @@ -1733,6 +1733,8 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n, { if (is_nonblocking) { + if (vcl_session_is_closing (s)) + return vcl_session_closing_error (s); svm_fifo_unset_event (s->rx_fifo); return VPPCOM_EWOULDBLOCK; } @@ -1897,7 +1899,7 @@ vppcom_session_write_inline (uint32_t session_handle, void *buf, size_t n, svm_msg_q_t *mq; u8 is_ct; - if (PREDICT_FALSE (!buf)) + if (PREDICT_FALSE (!buf || n == 0)) return VPPCOM_EINVAL; s = vcl_session_get_w_handle (wrk, session_handle); @@ -2627,9 +2629,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, break; case SESSION_CTRL_EVT_CONNECTED: connected_msg = (session_connected_msg_t *) e->data; - vcl_session_connected_handler (wrk, connected_msg); + sid = vcl_session_connected_handler (wrk, connected_msg); /* Generate EPOLLOUT because there's no connected event */ - sid = vcl_session_index_from_vpp_handle (wrk, connected_msg->handle); if (!(session = vcl_session_get (wrk, sid))) break; session_events = session->vep.ev.events;