From 165f07e7b48da454da66d0dd8c45d590a31e80f8 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 24 Nov 2017 10:08:09 +0100 Subject: [PATCH] MEDIUM: listener: Bind listeners on a thread subset if specified If a "process" option with a thread set is used on the bind line, we use the corresponding bitmask when the listener's FD is created. --- src/proto_tcp.c | 5 ++++- src/proto_uxst.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 5badda7e0..606c3c5e0 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1107,7 +1107,10 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) fdtab[fd].owner = listener; /* reference the listener instead of a task */ fdtab[fd].iocb = listener->proto->accept; - fd_insert(fd, MAX_THREADS_MASK); + if (listener->bind_conf->bind_thread[relative_pid-1]) + fd_insert(fd, listener->bind_conf->bind_thread[relative_pid-1]); + else + fd_insert(fd, MAX_THREADS_MASK); tcp_return: if (msg && errlen) { diff --git a/src/proto_uxst.c b/src/proto_uxst.c index fc4a51971..3b353c61a 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -334,7 +334,10 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle /* the function for the accept() event */ fdtab[fd].iocb = listener->proto->accept; fdtab[fd].owner = listener; /* reference the listener instead of a task */ - fd_insert(fd, MAX_THREADS_MASK); + if (listener->bind_conf->bind_thread[relative_pid-1]) + fd_insert(fd, listener->bind_conf->bind_thread[relative_pid-1]); + else + fd_insert(fd, MAX_THREADS_MASK); return err; err_rename: