diff options
author | liuyacan <liuyacan@corp.netease.com> | 2021-11-01 10:22:09 +0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-11-03 14:50:06 +0000 |
commit | ffd9ddbc4083d8d9d828b415eda33094ff31e5fe (patch) | |
tree | eb997ce53e9d5a31aefd56649b8dbeba21cbe63b | |
parent | 0d7fd782e058e6e1f1e80c1f2879da7ad8cf5892 (diff) |
vcl: fix event triggered after closing connections.
Improve the accuracy of epoll event(EPOLLRDHUP).
Type: fix
Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Change-Id: Ia31e696a0666c417ca99e684c6a4515f1cafc646
-rw-r--r-- | src/vcl/vppcom.c | 16 |
1 files changed, 15 insertions, 1 deletions
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) |