diff options
author | nandfan <fanyufei521@outlook.com> | 2021-03-26 16:46:58 +0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-03-28 16:34:55 +0000 |
commit | dc2632e010585e74216d557698ae127a212fe51f (patch) | |
tree | 256161de5452aec59c231c0918fdbafbb45301b2 /src/vcl/vcl_locked.c | |
parent | 92ccf9bcd2692b4b415f31044560c735d639a35c (diff) |
vcl: fix only first epoll listen session be registered
If configure listen port more than 1 with epoll in nginx, only first
listen port can be registered successed in nginx worker process.
Type: fix
Signed-off-by: nandfan <fanyufei521@outlook.com>
Change-Id: Iec2e058ee972a2cd5b2d1d7d20d373dc17084ce1
Diffstat (limited to 'src/vcl/vcl_locked.c')
-rw-r--r-- | src/vcl/vcl_locked.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c index 95da1aab54b..757c0fc45a7 100644 --- a/src/vcl/vcl_locked.c +++ b/src/vcl/vcl_locked.c @@ -51,7 +51,6 @@ typedef struct vls_local_ pthread_mutex_t vls_mt_mq_mlock; pthread_mutex_t vls_mt_spool_mlock; volatile u8 select_mp_check; - volatile u8 epoll_mp_check; } vls_process_local_t; static vls_process_local_t vls_local; @@ -1336,16 +1335,9 @@ vls_epoll_create (void) static void vls_epoll_ctl_mp_checks (vcl_locked_session_t * vls, int op) { - if (vcl_n_workers () <= 1) - { - vlsl->epoll_mp_check = 1; - return; - } - - if (op == EPOLL_CTL_MOD) + if (vcl_n_workers () <= 1 || op == EPOLL_CTL_MOD) return; - vlsl->epoll_mp_check = 1; vls_mp_checks (vls, op == EPOLL_CTL_ADD); } @@ -1372,11 +1364,8 @@ vls_epoll_ctl (vls_handle_t ep_vlsh, int op, vls_handle_t vlsh, vls = vls_get_and_lock (vlsh); sh = vls_to_sh (vls); - if (PREDICT_FALSE (!vlsl->epoll_mp_check)) - vls_epoll_ctl_mp_checks (vls, op); - + vls_epoll_ctl_mp_checks (vls, op); vls_mt_table_runlock (); - rv = vppcom_epoll_ctl (ep_sh, op, sh, event); vls_mt_table_rlock (); @@ -1619,7 +1608,6 @@ vls_app_fork_child_handler (void) vlsl->vls_mt_n_threads = 0; vlsl->vls_wrk_index = vcl_get_worker_index (); vlsl->select_mp_check = 0; - vlsl->epoll_mp_check = 0; vls_mt_locks_init (); VDBG (0, "forked child main worker initialized"); |