Commit 9aec2e5b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Due to lack og foresight,the threads that keep an eye on client connections

to see if they get reused ended up being named "acceptors", which is a bad
name because we have another thread which accepts new connections.

Rename the "fake" acceptors to "waiters"



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3758 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f32dbb90
...@@ -8,10 +8,10 @@ dist_man_MANS = varnishd.1 ...@@ -8,10 +8,10 @@ dist_man_MANS = varnishd.1
varnishd_SOURCES = \ varnishd_SOURCES = \
cache_acceptor.c \ cache_acceptor.c \
cache_acceptor_epoll.c \ cache_waiter_epoll.c \
cache_acceptor_kqueue.c \ cache_waiter_kqueue.c \
cache_acceptor_poll.c \ cache_waiter_poll.c \
cache_acceptor_ports.c \ cache_waiter_ports.c \
cache_backend.c \ cache_backend.c \
cache_backend_cfg.c \ cache_backend_cfg.c \
cache_backend_poll.c \ cache_backend_poll.c \
...@@ -60,7 +60,7 @@ varnishd_SOURCES = \ ...@@ -60,7 +60,7 @@ varnishd_SOURCES = \
noinst_HEADERS = \ noinst_HEADERS = \
acct_fields.h \ acct_fields.h \
cache.h \ cache.h \
cache_acceptor.h \ cache_waiter.h \
cache_backend.h \ cache_backend.h \
cache_backend_poll.h \ cache_backend_poll.h \
common.h \ common.h \
......
...@@ -47,23 +47,23 @@ ...@@ -47,23 +47,23 @@
#include "cli_priv.h" #include "cli_priv.h"
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
#include "cache_acceptor.h" #include "cache_waiter.h"
static struct acceptor * const vca_acceptors[] = { static struct waiter * const vca_waiters[] = {
#if defined(HAVE_KQUEUE) #if defined(HAVE_KQUEUE)
&acceptor_kqueue, &waiter_kqueue,
#endif #endif
#if defined(HAVE_EPOLL_CTL) #if defined(HAVE_EPOLL_CTL)
&acceptor_epoll, &waiter_epoll,
#endif #endif
#if defined(HAVE_PORT_CREATE) #if defined(HAVE_PORT_CREATE)
&acceptor_ports, &waiter_ports,
#endif #endif
&acceptor_poll, &waiter_poll,
NULL, NULL,
}; };
static struct acceptor const *vca_act; static struct waiter const *vca_act;
static pthread_t vca_thread_acct; static pthread_t vca_thread_acct;
static struct timeval tv_sndtimeo; static struct timeval tv_sndtimeo;
...@@ -322,7 +322,7 @@ ccf_start(struct cli *cli, const char * const *av, void *priv) ...@@ -322,7 +322,7 @@ ccf_start(struct cli *cli, const char * const *av, void *priv)
(void)priv; (void)priv;
if (vca_act == NULL) if (vca_act == NULL)
vca_act = vca_acceptors[0]; vca_act = vca_waiters[0];
AN(vca_act); AN(vca_act);
AN(vca_act->name); AN(vca_act->name);
...@@ -347,7 +347,7 @@ VCA_Init(void) ...@@ -347,7 +347,7 @@ VCA_Init(void)
} }
void void
VCA_tweak_acceptor(struct cli *cli, const char *arg) VCA_tweak_waiter(struct cli *cli, const char *arg)
{ {
int i; int i;
...@@ -358,9 +358,9 @@ VCA_tweak_acceptor(struct cli *cli, const char *arg) ...@@ -358,9 +358,9 @@ VCA_tweak_acceptor(struct cli *cli, const char *arg)
cli_out(cli, "%s", vca_act->name); cli_out(cli, "%s", vca_act->name);
cli_out(cli, " ("); cli_out(cli, " (");
for (i = 0; vca_acceptors[i] != NULL; i++) for (i = 0; vca_waiters[i] != NULL; i++)
cli_out(cli, "%s%s", i == 0 ? "" : ", ", cli_out(cli, "%s%s", i == 0 ? "" : ", ",
vca_acceptors[i]->name); vca_waiters[i]->name);
cli_out(cli, ")"); cli_out(cli, ")");
return; return;
} }
...@@ -368,12 +368,12 @@ VCA_tweak_acceptor(struct cli *cli, const char *arg) ...@@ -368,12 +368,12 @@ VCA_tweak_acceptor(struct cli *cli, const char *arg)
vca_act = NULL; vca_act = NULL;
return; return;
} }
for (i = 0; vca_acceptors[i]->name; i++) { for (i = 0; vca_waiters[i]->name; i++) {
if (!strcmp(arg, vca_acceptors[i]->name)) { if (!strcmp(arg, vca_waiters[i]->name)) {
vca_act = vca_acceptors[i]; vca_act = vca_waiters[i];
return; return;
} }
} }
cli_out(cli, "Unknown acceptor"); cli_out(cli, "Unknown waiter");
cli_result(cli, CLIS_PARAM); cli_result(cli, CLIS_PARAM);
} }
...@@ -31,29 +31,29 @@ ...@@ -31,29 +31,29 @@
struct sess; struct sess;
typedef void acceptor_init_f(void); typedef void waiter_init_f(void);
typedef void acceptor_pass_f(struct sess *); typedef void waiter_pass_f(struct sess *);
extern int vca_pipes[2]; extern int vca_pipes[2];
struct acceptor { struct waiter {
const char *name; const char *name;
acceptor_init_f *init; waiter_init_f *init;
acceptor_pass_f *pass; waiter_pass_f *pass;
}; };
#if defined(HAVE_EPOLL_CTL) #if defined(HAVE_EPOLL_CTL)
extern struct acceptor acceptor_epoll; extern struct waiter waiter_epoll;
#endif #endif
#if defined(HAVE_KQUEUE) #if defined(HAVE_KQUEUE)
extern struct acceptor acceptor_kqueue; extern struct waiter waiter_kqueue;
#endif #endif
extern struct acceptor acceptor_poll; extern struct waiter waiter_poll;
#if defined(HAVE_PORT_CREATE) #if defined(HAVE_PORT_CREATE)
extern struct acceptor acceptor_ports; extern struct waiter waiter_ports;
#endif #endif
/* vca_acceptor.c */ /* vca_acceptor.c */
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
#include "cache_acceptor.h" #include "cache_waiter.h"
static pthread_t vca_epoll_thread; static pthread_t vca_epoll_thread;
static int epfd = -1; static int epfd = -1;
...@@ -133,7 +133,7 @@ vca_epoll_init(void) ...@@ -133,7 +133,7 @@ vca_epoll_init(void)
AZ(pthread_create(&vca_epoll_thread, NULL, vca_main, NULL)); AZ(pthread_create(&vca_epoll_thread, NULL, vca_main, NULL));
} }
struct acceptor acceptor_epoll = { struct waiter waiter_epoll = {
.name = "epoll", .name = "epoll",
.init = vca_epoll_init, .init = vca_epoll_init,
}; };
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
#include "cache_acceptor.h" #include "cache_waiter.h"
/**********************************************************************/ /**********************************************************************/
...@@ -217,7 +217,7 @@ vca_kqueue_init(void) ...@@ -217,7 +217,7 @@ vca_kqueue_init(void)
AZ(pthread_create(&vca_kqueue_thread, NULL, vca_kqueue_main, NULL)); AZ(pthread_create(&vca_kqueue_thread, NULL, vca_kqueue_main, NULL));
} }
struct acceptor acceptor_kqueue = { struct waiter waiter_kqueue = {
.name = "kqueue", .name = "kqueue",
.init = vca_kqueue_init, .init = vca_kqueue_init,
}; };
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
#include "cache_acceptor.h" #include "cache_waiter.h"
static pthread_t vca_poll_thread; static pthread_t vca_poll_thread;
static struct pollfd *pollfd; static struct pollfd *pollfd;
...@@ -161,7 +161,7 @@ vca_poll_init(void) ...@@ -161,7 +161,7 @@ vca_poll_init(void)
AZ(pthread_create(&vca_poll_thread, NULL, vca_main, NULL)); AZ(pthread_create(&vca_poll_thread, NULL, vca_main, NULL));
} }
struct acceptor acceptor_poll = { struct waiter waiter_poll = {
.name = "poll", .name = "poll",
.init = vca_poll_init, .init = vca_poll_init,
}; };
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include "shmlog.h" #include "shmlog.h"
#include "cache.h" #include "cache.h"
#include "cache_acceptor.h" #include "cache_waiter.h"
#define MAX_EVENTS 256 #define MAX_EVENTS 256
static pthread_t vca_ports_thread; static pthread_t vca_ports_thread;
...@@ -162,7 +162,7 @@ vca_ports_init(void) ...@@ -162,7 +162,7 @@ vca_ports_init(void)
AZ(pthread_create(&vca_ports_thread, NULL, vca_main, NULL)); AZ(pthread_create(&vca_ports_thread, NULL, vca_main, NULL));
} }
struct acceptor acceptor_ports = { struct waiter waiter_ports = {
.name = "ports", .name = "ports",
.init = vca_ports_init, .init = vca_ports_init,
.pass = vca_ports_pass .pass = vca_ports_pass
......
...@@ -33,7 +33,7 @@ struct cli; ...@@ -33,7 +33,7 @@ struct cli;
struct sockaddr; struct sockaddr;
/* cache_acceptor.c */ /* cache_acceptor.c */
void VCA_tweak_acceptor(struct cli *cli, const char *arg); void VCA_tweak_waiter(struct cli *cli, const char *arg);
/* shmlog.c */ /* shmlog.c */
void VSL_Panic(int *len, char **ptr); void VSL_Panic(int *len, char **ptr);
......
...@@ -413,12 +413,12 @@ tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg) ...@@ -413,12 +413,12 @@ tweak_cc_command(struct cli *cli, const struct parspec *par, const char *arg)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
static void static void
tweak_acceptor(struct cli *cli, const struct parspec *par, const char *arg) tweak_waiter(struct cli *cli, const struct parspec *par, const char *arg)
{ {
/* XXX should have tweak_generic_string */ /* XXX should have tweak_generic_string */
(void)par; (void)par;
VCA_tweak_acceptor(cli, arg); VCA_tweak_waiter(cli, arg);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -701,7 +701,7 @@ static const struct parspec input_parspec[] = { ...@@ -701,7 +701,7 @@ static const struct parspec input_parspec[] = {
"completing.\n" "completing.\n"
"Setting this too high results in worker threads not doing " "Setting this too high results in worker threads not doing "
"anything for their keep, setting it too low just means that " "anything for their keep, setting it too low just means that "
"more sessions take a detour around the acceptor.", "more sessions take a detour around the waiter.",
EXPERIMENTAL, EXPERIMENTAL,
"0", "ms" }, "0", "ms" },
{ "cli_buffer", tweak_uint, &master.cli_buffer, 4096, UINT_MAX, { "cli_buffer", tweak_uint, &master.cli_buffer, 4096, UINT_MAX,
...@@ -726,8 +726,8 @@ static const struct parspec input_parspec[] = { ...@@ -726,8 +726,8 @@ static const struct parspec input_parspec[] = {
"SessionOpen shared memory record.\n", "SessionOpen shared memory record.\n",
0, 0,
"off", "bool" }, "off", "bool" },
{ "acceptor", tweak_acceptor, NULL, 0, 0, { "waiter", tweak_waiter, NULL, 0, 0,
"Select the acceptor kernel interface.\n", "Select the waiter kernel interface.\n",
EXPERIMENTAL | MUST_RESTART, EXPERIMENTAL | MUST_RESTART,
"default", NULL }, "default", NULL },
{ "diag_bitmap", tweak_diag_bitmap, 0, 0, 0, { "diag_bitmap", tweak_diag_bitmap, 0, 0, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment