diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-19 12:08:56 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-19 12:08:56 +0000 |
commit | 1919128b52ab85cdce80c42468da3dd2c2e24cc8 (patch) | |
tree | 5017385397d80aa13d325e26392cbc6715f386e8 /usr.sbin/relayd/control.c | |
parent | 606ce456a609f715d65446676b7212d3d4a28715 (diff) |
Add the ability to schedule an immediate check through hoststatectl.
Especially useful when interval is rather long.
I was supposed to commit this before 4.2.
Diffstat (limited to 'usr.sbin/relayd/control.c')
-rw-r--r-- | usr.sbin/relayd/control.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c index 08094fe9547..5ea9d46fb02 100644 --- a/usr.sbin/relayd/control.c +++ b/usr.sbin/relayd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.18 2007/09/07 08:20:24 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.19 2007/10/19 12:08:55 pyr Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -43,6 +43,7 @@ struct ctl_conn *control_connbyfd(int); void control_close(int); struct imsgbuf *ibuf_main = NULL; +struct imsgbuf *ibuf_hce = NULL; int control_init(void) @@ -94,10 +95,12 @@ control_init(void) } int -control_listen(struct hoststated *env, struct imsgbuf *ibuf) +control_listen(struct hoststated *env, struct imsgbuf *i_main, + struct imsgbuf *i_hce) { - ibuf_main = ibuf; + ibuf_main = i_main; + ibuf_hce = i_hce; if (listen(control_state.fd, CONTROL_BACKLOG) == -1) { log_warn("control_listen: listen"); @@ -316,6 +319,10 @@ control_dispatch_imsg(int fd, short event, void *arg) imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, NULL, 0); break; + case IMSG_CTL_POLL: + imsg_compose(ibuf_hce, IMSG_CTL_POLL, 0, 0,-1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; case IMSG_CTL_RELOAD: if (env->prefork_relay > 0) { imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, |