vcl: avoid duplicated events in epoll lt
1. Filter event ACCEPTED for lt (same as event RX)
2. Do lt check before vppcom_epoll_wait_xxx to avoid
delivering duplicated events.
Type: fix
Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Change-Id: Ib41c880ceb5072d49e11ab42e31e54398703c0b5
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 86a0c64..987a19c 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -3048,7 +3048,8 @@
break;
session_events = s->vep.ev.events;
sid = s->session_index;
- if (!(EPOLLIN & session_events))
+ if (!(EPOLLIN & session_events) ||
+ (s->vep.lt_next != VCL_INVALID_SESSION_INDEX))
break;
add_event = 1;
events[*num_ev].events = EPOLLIN;
@@ -3364,6 +3365,10 @@
}
vec_reset_length (wrk->unhandled_evts_vector);
}
+
+ if (PREDICT_FALSE (wrk->ep_lt_current != VCL_INVALID_SESSION_INDEX))
+ vcl_epoll_wait_handle_lt (wrk, events, maxevents, &n_evts);
+
/* Request to only drain unhandled */
if ((int) wait_for_time == -2)
return n_evts;
@@ -3376,9 +3381,6 @@
n_evts = vppcom_epoll_wait_condvar (wrk, events, maxevents, n_evts,
wait_for_time);
- if (PREDICT_FALSE (wrk->ep_lt_current != VCL_INVALID_SESSION_INDEX))
- vcl_epoll_wait_handle_lt (wrk, events, maxevents, &n_evts);
-
return n_evts;
}