summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-05-26 00:47:52 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-05-26 11:28:49 +0000
commit0f878da203b0725071fdfcc3648ed67d5ada2af7 (patch)
treebcc2155862ba957d80e3cf223ef3fddb67320f0a /src
parent89c12dbe239dc6d8bde1a99f970d05556db6bd98 (diff)
vcl: do not propagate epoll events if session closed
Type: fix Ticket: VPP-1880 Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1e9652b476bbc07852b4e701a948c36a0d8c67fa
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vcl_private.h6
-rw-r--r--src/vcl/vppcom.c17
2 files changed, 17 insertions, 6 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index c4ec02e8306..de3304ff222 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -548,6 +548,12 @@ vcl_session_is_closing (vcl_session_t * s)
|| s->session_state == STATE_DISCONNECT);
}
+static inline u8
+vcl_session_is_closed (vcl_session_t * s)
+{
+ return (!s || (s->session_state == STATE_CLOSED));
+}
+
static inline int
vcl_session_closing_error (vcl_session_t * s)
{
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 173b7fdd556..30fb76335bc 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -550,7 +550,8 @@ vcl_session_reset_handler (vcl_worker_t * wrk,
return VCL_INVALID_SESSION_INDEX;
}
- session->session_state = STATE_DISCONNECT;
+ if (session->session_state != STATE_CLOSED)
+ session->session_state = STATE_DISCONNECT;
VDBG (0, "reset session %u [0x%llx]", sid, reset_msg->handle);
return sid;
}
@@ -2776,7 +2777,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
{
case SESSION_IO_EVT_RX:
sid = e->session_index;
- if (!(session = vcl_session_get (wrk, sid)))
+ session = vcl_session_get (wrk, sid);
+ if (vcl_session_is_closed (session))
break;
vcl_fifo_rx_evt_valid_or_break (session);
session_events = session->vep.ev.events;
@@ -2789,7 +2791,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
case SESSION_IO_EVT_TX:
sid = e->session_index;
- if (!(session = vcl_session_get (wrk, sid)))
+ session = vcl_session_get (wrk, sid);
+ if (vcl_session_is_closed (session))
break;
session_events = session->vep.ev.events;
if (!(EPOLLOUT & session_events))
@@ -2817,7 +2820,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
connected_msg = (session_connected_msg_t *) e->data;
sid = vcl_session_connected_handler (wrk, connected_msg);
/* Generate EPOLLOUT because there's no connected event */
- if (!(session = vcl_session_get (wrk, sid)))
+ session = vcl_session_get (wrk, sid);
+ if (vcl_session_is_closed (session))
break;
session_events = session->vep.ev.events;
if (!(EPOLLOUT & session_events))
@@ -2831,7 +2835,7 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
case SESSION_CTRL_EVT_DISCONNECTED:
disconnected_msg = (session_disconnected_msg_t *) e->data;
session = vcl_session_disconnected_handler (wrk, disconnected_msg);
- if (!session)
+ if (vcl_session_is_closed (session))
break;
session_events = session->vep.ev.events;
add_event = 1;
@@ -2840,7 +2844,8 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
case SESSION_CTRL_EVT_RESET:
sid = vcl_session_reset_handler (wrk, (session_reset_msg_t *) e->data);
- if (!(session = vcl_session_get (wrk, sid)))
+ session = vcl_session_get (wrk, sid);
+ if (vcl_session_is_closed (session))
break;
session_events = session->vep.ev.events;
add_event = 1;