diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-05-29 18:59:55 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-05-29 18:59:55 +0000 |
commit | c32d778c72106a5a52db85146c72e28edca9b9d2 (patch) | |
tree | 8c11bcfee1dca3c147261430da9b7bc8278030a8 /usr.sbin/hoststated | |
parent | 3a9bcd281374fc13030a84abca6152545feb52c9 (diff) |
do not start relay processes when no L7 load balancing is needed.
ok reyk@
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r-- | usr.sbin/hoststated/hoststated.c | 14 | ||||
-rw-r--r-- | usr.sbin/hoststated/parse.y | 5 |
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c index ad04abc7f59..8e15e31f67f 100644 --- a/usr.sbin/hoststated/hoststated.c +++ b/usr.sbin/hoststated/hoststated.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hoststated.c,v 1.27 2007/05/29 17:12:04 reyk Exp $ */ +/* $OpenBSD: hoststated.c,v 1.28 2007/05/29 18:59:53 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -209,8 +209,9 @@ main(int argc, char *argv[]) pipe_parent2relay, pipe_pfe2hce, pipe_pfe2relay); hce_pid = hce(env, pipe_parent2pfe, pipe_parent2hce, pipe_parent2relay, pipe_pfe2hce, pipe_pfe2relay); - relay_pid = relay(env, pipe_parent2pfe, pipe_parent2hce, - pipe_parent2relay, pipe_pfe2hce, pipe_pfe2relay); + if (env->prefork_relay > 0) + relay_pid = relay(env, pipe_parent2pfe, pipe_parent2hce, + pipe_parent2relay, pipe_pfe2hce, pipe_pfe2relay); setproctitle("parent"); @@ -237,9 +238,12 @@ main(int argc, char *argv[]) } if ((ibuf_pfe = calloc(1, sizeof(struct imsgbuf))) == NULL || - (ibuf_hce = calloc(1, sizeof(struct imsgbuf))) == NULL || + (ibuf_hce = calloc(1, sizeof(struct imsgbuf))) == NULL) + fatal(NULL); + + if (env->prefork_relay > 0 && (ibuf_relay = calloc(env->prefork_relay, - sizeof(struct imsgbuf))) == NULL) + sizeof(struct imsgbuf)) == NULL)) fatal(NULL); imsg_init(ibuf_pfe, pipe_parent2pfe[0], main_dispatch_pfe); diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y index 49f89707f0d..4d801634b9e 100644 --- a/usr.sbin/hoststated/parse.y +++ b/usr.sbin/hoststated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.45 2007/05/29 17:12:04 reyk Exp $ */ +/* $OpenBSD: parse.y,v 1.46 2007/05/29 18:59:54 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -1474,6 +1474,9 @@ parse_config(const char *filename, int opts) errors++; } + if (TAILQ_EMPTY(&conf->relays)) + conf->prefork_relay = 0; + if (timercmp(&conf->timeout, &conf->interval, >=)) { log_warnx("global timeout exceeds interval"); errors++; |