diff options
author | Florin Coras <fcoras@cisco.com> | 2018-12-15 18:30:43 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-12-17 17:22:22 +0000 |
commit | 05ce4b8b79e65d0baf47dbc0970bee163eb2c797 (patch) | |
tree | 14c3e70c73817da0e8b6272b6aa6e307bb240a22 | |
parent | 66b48a9c6155a2c088f0f45fc568c846edb4b1af (diff) |
vcl: handle reset while reading/writing data
Change-Id: I73d1dde5b78bbb7835f3a4f0d35fc0d5e46ec103
Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r-- | src/vcl/vppcom.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 773350ae0c9..a456ed0e4cd 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1551,15 +1551,11 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n, e = svm_msg_q_msg_data (mq, &msg); svm_msg_q_unlock (mq); if (!vcl_is_rx_evt_for_session (e, s->session_index, is_ct)) - { - vcl_handle_mq_event (wrk, e); - svm_msg_q_free_msg (mq, &msg); - continue; - } + vcl_handle_mq_event (wrk, e); svm_msg_q_free_msg (mq, &msg); - if (PREDICT_FALSE (s->session_state == STATE_VPP_CLOSING)) - return 0; + if (PREDICT_FALSE (s->session_state == STATE_DISCONNECT)) + return VPPCOM_ECONNRESET; } } @@ -1644,15 +1640,11 @@ vppcom_session_read_segments (uint32_t session_handle, e = svm_msg_q_msg_data (mq, &msg); svm_msg_q_unlock (mq); if (!vcl_is_rx_evt_for_session (e, s->session_index, is_ct)) - { - vcl_handle_mq_event (wrk, e); - svm_msg_q_free_msg (mq, &msg); - continue; - } + vcl_handle_mq_event (wrk, e); svm_msg_q_free_msg (mq, &msg); - if (PREDICT_FALSE (s->session_state == STATE_VPP_CLOSING)) - return 0; + if (PREDICT_FALSE (s->session_state == STATE_DISCONNECT)) + return VPPCOM_ECONNRESET; } } @@ -1802,12 +1794,12 @@ vppcom_session_write_inline (uint32_t session_handle, void *buf, size_t n, if (!vcl_is_tx_evt_for_session (e, s->session_index, is_ct)) vcl_handle_mq_event (wrk, e); svm_msg_q_free_msg (mq, &msg); + + if (PREDICT_FALSE (!(s->session_state & STATE_OPEN))) + return VPPCOM_ECONNRESET; } } - if (PREDICT_FALSE (!(s->session_state & STATE_OPEN))) - return VPPCOM_ECONNRESET; - ASSERT (FIFO_EVENT_APP_TX + 1 == SESSION_IO_EVT_CT_TX); et = FIFO_EVENT_APP_TX + vcl_session_is_ct (s); if (is_flush && !vcl_session_is_ct (s)) |