mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 07:27:59 -08:00
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@
This commit is contained in:
parent
476465cf0b
commit
19a6b45e5e
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user