summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-11 10:14:37 -0700
committerFlorin Coras <fcoras@cisco.com>2019-03-11 10:14:37 -0700
commit2d9b427a5b20dcec3d2212a3a8a47c29b4acdd46 (patch)
tree057ff094b23aaf2f4dd78aa5f8d848cb5918af82 /src/vcl
parentf3a5a9327bfe94968b25f44cc184e1f2518323e4 (diff)
ldp: fix worker alloc when using eventfds
Change-Id: Icfba7ae9cbf504a8966923eac06c9eb0e11899d2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/ldp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 2468bcc4750..338c091754b 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -161,6 +161,14 @@ ldp_fd_to_vlsh (int fd)
return (fd - ldp->vlsh_bit_val);
}
+static void
+ldp_alloc_workers (void)
+{
+ if (ldp->workers)
+ return;
+ pool_alloc (ldp->workers, LDP_MAX_NWORKERS);
+}
+
static inline int
ldp_init (void)
{
@@ -184,7 +192,7 @@ ldp_init (void)
return rv;
}
ldp->vcl_needs_real_epoll = 0;
- pool_alloc (ldp->workers, LDP_MAX_NWORKERS);
+ ldp_alloc_workers ();
ldpw = ldp_worker_get_current ();
char *env_var_str = getenv (LDP_ENV_DEBUG);
@@ -2040,6 +2048,12 @@ epoll_create1 (int flags)
if (ldp->vcl_needs_real_epoll)
{
+ /* Make sure workers have been allocated */
+ if (!ldp->workers)
+ {
+ ldp_alloc_workers ();
+ ldpw = ldp_worker_get_current ();
+ }
rv = libc_epoll_create1 (flags);
ldp->vcl_needs_real_epoll = 0;
ldpw->vcl_mq_epfd = rv;