Browse Source

when using a timedelta sensor for -s, if the sensor is invalid during

the first query we will never do the settime because
SENSOR_QUERY_INTERVAL (30s) is greater than SETTIME_TIMEOUT (15s).  so
during the settime period only, be more aggressive and use
SETTIME_TIMEOUT/3 for the query interval.
ok henning@
OPENBSD_4_6
stevesk 15 years ago
parent
commit
d3e46edd9e
2 changed files with 10 additions and 6 deletions
  1. +5
    -4
      src/usr.sbin/ntpd/ntpd.h
  2. +5
    -2
      src/usr.sbin/ntpd/sensors.c

+ 5
- 4
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.99 2009/02/11 01:00:10 stevesk Exp $ */
/* $OpenBSD: ntpd.h,v 1.100 2009/05/13 15:08:10 stevesk Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -63,9 +63,10 @@
#define MAX_SEND_ERRORS 3 /* max send errors before reconnect */ #define MAX_SEND_ERRORS 3 /* max send errors before reconnect */
#define SENSOR_DATA_MAXAGE (15*60)
#define SENSOR_QUERY_INTERVAL 30
#define SENSOR_SCAN_INTERVAL (5*60)
#define SENSOR_DATA_MAXAGE (15*60)
#define SENSOR_QUERY_INTERVAL 30
#define SENSOR_QUERY_INTERVAL_SETTIME (SETTIME_TIMEOUT/3)
#define SENSOR_SCAN_INTERVAL (5*60)
enum client_state { enum client_state {
STATE_NONE, STATE_NONE,


+ 5
- 2
src/usr.sbin/ntpd/sensors.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: sensors.c,v 1.43 2009/02/08 23:57:08 stevesk Exp $ */
/* $OpenBSD: sensors.c,v 1.44 2009/05/13 15:08:10 stevesk Exp $ */
/* /*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org> * Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@ -154,7 +154,10 @@ sensor_query(struct ntp_sensor *s)
char dxname[MAXDEVNAMLEN]; char dxname[MAXDEVNAMLEN];
struct sensor sensor; struct sensor sensor;
s->next = getmonotime() + SENSOR_QUERY_INTERVAL;
if (conf->settime)
s->next = getmonotime() + SENSOR_QUERY_INTERVAL_SETTIME;
else
s->next = getmonotime() + SENSOR_QUERY_INTERVAL;
/* rcvd is walltime here, monotime in client.c. not used elsewhere */ /* rcvd is walltime here, monotime in client.c. not used elsewhere */
if (s->update.rcvd < time(NULL) - SENSOR_DATA_MAXAGE) if (s->update.rcvd < time(NULL) - SENSOR_DATA_MAXAGE)


Loading…
Cancel
Save