diff options
author | 2019-09-25 16:37:43 -0700 | |
---|---|---|
committer | 2019-11-18 13:12:13 +0000 | |
commit | b3f54ec401086996d4a0721cc27f271e5b10576b (patch) | |
tree | 6c43355f3b421edfc36f1dc25c79bd647f7f8e6f /src/vcl/vppcom.c | |
parent | 57997c8748efd9023759e7270cedbf2124cf8d6e (diff) |
vcl: handle segment map errors
Type: fix
Change-Id: Ibd122a4565c067627c4bbc8cac7df2d5b6497392
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit dbc9c599b9d4453c7433ac59dd21f088778e024b)
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 38931dc4a83..47ea7a479b1 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -449,19 +449,23 @@ vcl_session_connected_handler (vcl_worker_t * wrk, { VDBG (0, "ERROR: session index %u: connect failed! %U", session_index, format_api_error, ntohl (mp->retval)); - session->session_state = STATE_FAILED; + session->session_state = STATE_FAILED | STATE_DISCONNECT; session->vpp_handle = mp->handle; return session_index; } + session->vpp_handle = mp->handle; + session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address, + svm_msg_q_t *); rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *); tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *); if (vcl_wait_for_segment (mp->segment_handle)) { VDBG (0, "segment for session %u couldn't be mounted!", session->session_index); - session->session_state = STATE_FAILED; - return VCL_INVALID_SESSION_INDEX; + session->session_state = STATE_FAILED | STATE_DISCONNECT; + vcl_send_session_disconnect (wrk, session); + return session_index; } rx_fifo->client_session_index = session_index; @@ -469,8 +473,6 @@ vcl_session_connected_handler (vcl_worker_t * wrk, rx_fifo->client_thread_index = vcl_get_worker_index (); tx_fifo->client_thread_index = vcl_get_worker_index (); - session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address, - svm_msg_q_t *); vpp_wrk_index = tx_fifo->master_thread_index; vec_validate (wrk->vpp_event_queues, vpp_wrk_index); wrk->vpp_event_queues[vpp_wrk_index] = session->vpp_evt_q; @@ -483,14 +485,14 @@ vcl_session_connected_handler (vcl_worker_t * wrk, { VDBG (0, "ct segment for session %u couldn't be mounted!", session->session_index); - session->session_state = STATE_FAILED; - return VCL_INVALID_SESSION_INDEX; + session->session_state = STATE_FAILED | STATE_DISCONNECT; + vcl_send_session_disconnect (wrk, session); + return session_index; } } session->rx_fifo = rx_fifo; session->tx_fifo = tx_fifo; - session->vpp_handle = mp->handle; session->vpp_thread_index = rx_fifo->master_thread_index; session->transport.is_ip4 = mp->lcl.is_ip4; clib_memcpy_fast (&session->transport.lcl_ip, &mp->lcl.ip, @@ -2636,6 +2638,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, add_event = 1; events[*num_ev].events |= EPOLLOUT; session_evt_data = session->vep.ev.data.u64; + if (session->session_state & STATE_FAILED) + events[*num_ev].events |= EPOLLHUP; break; case SESSION_CTRL_EVT_DISCONNECTED: disconnected_msg = (session_disconnected_msg_t *) e->data; |