diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2021-02-22 01:25:00 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2021-02-22 01:25:00 +0000 |
commit | fee24073de9535877ad792dd68c92ab14e850609 (patch) | |
tree | 0ec3c9fd20a2d85bd4f6284ecc1adfd668591b0e /usr.sbin | |
parent | 1f6a8118182da2a50531b860768fdbfd86c68245 (diff) |
Use the F_CHECK_SENT and F_CHECK_DONE flags to determine whether a
previous attempt at running a check script has finished yet, so we
can avoid building up a backlog of check requests.
ok dlg@ tb@ giovanni@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/relayd/check_script.c | 9 | ||||
-rw-r--r-- | usr.sbin/relayd/hce.c | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c index cf51a835c8f..d0cd1f6fc7f 100644 --- a/usr.sbin/relayd/check_script.c +++ b/usr.sbin/relayd/check_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check_script.c,v 1.21 2017/05/28 10:39:15 benno Exp $ */ +/* $OpenBSD: check_script.c,v 1.22 2021/02/22 01:24:59 jmatthew Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -38,6 +38,9 @@ check_script(struct relayd *env, struct host *host) struct ctl_script scr; struct table *table; + if ((host->flags & (F_CHECK_SENT|F_CHECK_DONE)) == F_CHECK_SENT) + return; + if ((table = table_find(env, host->conf.tableid)) == NULL) fatalx("%s: invalid table id", __func__); @@ -52,7 +55,9 @@ check_script(struct relayd *env, struct host *host) fatalx("invalid script path"); memcpy(&scr.timeout, &table->conf.timeout, sizeof(scr.timeout)); - proc_compose(env->sc_ps, PROC_PARENT, IMSG_SCRIPT, &scr, sizeof(scr)); + if (proc_compose(env->sc_ps, PROC_PARENT, IMSG_SCRIPT, &scr, + sizeof(scr)) == 0) + host->flags |= F_CHECK_SENT; } void diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c index 8fb7701d047..f1a5082504b 100644 --- a/usr.sbin/relayd/hce.c +++ b/usr.sbin/relayd/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.79 2018/08/06 17:31:31 benno Exp $ */ +/* $OpenBSD: hce.c,v 1.80 2021/02/22 01:24:59 jmatthew Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -139,7 +139,6 @@ hce_launch_checks(int fd, short event, void *arg) TAILQ_FOREACH(host, &table->hosts, entry) { if ((host->flags & F_CHECK_DONE) == 0) host->he = HCE_INTERVAL_TIMEOUT; - host->flags &= ~(F_CHECK_SENT|F_CHECK_DONE); if (event_initialized(&host->cte.ev)) { event_del(&host->cte.ev); close(host->cte.s); |