From ffd9ddbc4083d8d9d828b415eda33094ff31e5fe Mon Sep 17 00:00:00 2001 From: liuyacan Date: Mon, 1 Nov 2021 10:22:09 +0800 Subject: vcl: fix event triggered after closing connections. Improve the accuracy of epoll event(EPOLLRDHUP). Type: fix Signed-off-by: liuyacan Change-Id: Ia31e696a0666c417ca99e684c6a4515f1cafc646 --- src/vcl/vppcom.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index b91c3a3bff4..9f8edce4965 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -3089,8 +3089,22 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, sid = s->session_index; session_events = s->vep.ev.events; add_event = 1; - events[*num_ev].events = EPOLLHUP | EPOLLRDHUP; + if (EPOLLRDHUP & session_events) + { + /* If app can distinguish between RDHUP and HUP, + * we make finer control */ + events[*num_ev].events = EPOLLRDHUP; + if (s->flags & VCL_SESSION_F_WR_SHUTDOWN) + { + events[*num_ev].events |= EPOLLHUP; + } + } + else + { + events[*num_ev].events = EPOLLHUP; + } session_evt_data = s->vep.ev.data.u64; + break; case SESSION_CTRL_EVT_RESET: if (!e->postponed) -- cgit 1.2.3-korg