Browse Source

scan for new timedelta sensors every five minutes for now, ok deraadt

OPENBSD_4_0
henning 18 years ago
parent
commit
c24767cca2
2 changed files with 8 additions and 4 deletions
  1. +6
    -3
      src/usr.sbin/ntpd/ntp.c
  2. +2
    -1
      src/usr.sbin/ntpd/ntpd.h

+ 6
- 3
src/usr.sbin/ntpd/ntp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.71 2006/05/26 00:33:16 henning Exp $ */
/* $OpenBSD: ntp.c,v 1.72 2006/05/27 18:32:00 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -76,7 +76,7 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
struct ntp_sensor *s, *next_s;
struct timespec tp;
struct stat stb;
time_t nextaction;
time_t nextaction, last_sensor_scan = 0;
void *newp;
switch (pid = fork()) {
@ -149,7 +149,6 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
conf->scale = 1;
sensor_init(conf);
sensor_scan(conf);
log_info("ntp engine ready");
@ -232,6 +231,10 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
}
}
if (last_sensor_scan + SENSOR_SCAN_INTERVAL < time(NULL)) {
sensor_scan(conf);
last_sensor_scan = time(NULL);
}
sensors_cnt = 0;
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) {
sensors_cnt++;


+ 2
- 1
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.64 2006/05/27 17:01:07 henning Exp $ */
/* $OpenBSD: ntpd.h,v 1.65 2006/05/27 18:32:00 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -60,6 +60,7 @@
#define SENSOR_DATA_MAXAGE 15*60
#define SENSOR_QUERY_INTERVAL 30
#define SENSOR_SCAN_INTERVAL 5*60
enum client_state {
STATE_NONE,


Loading…
Cancel
Save