Browse Source

Delay before retrying a query on timeout; ok henning@

OPENBSD_3_7
dtucker 20 years ago
parent
commit
5d09ee1c02
3 changed files with 11 additions and 9 deletions
  1. +1
    -3
      src/usr.sbin/ntpd/client.c
  2. +7
    -5
      src/usr.sbin/ntpd/ntp.c
  3. +3
    -1
      src/usr.sbin/ntpd/ntpd.h

+ 1
- 3
src/usr.sbin/ntpd/client.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.51 2004/12/15 12:29:25 dtucker Exp $ */
/* $OpenBSD: client.c,v 1.52 2005/01/27 10:32:29 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -27,9 +27,7 @@
#include "ntpd.h"
int client_update(struct ntp_peer *);
void set_next(struct ntp_peer *, time_t);
void set_deadline(struct ntp_peer *, time_t);
time_t scale_interval(time_t, double);
void
set_next(struct ntp_peer *p, time_t t)


+ 7
- 5
src/usr.sbin/ntpd/ntp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.46 2004/12/23 16:10:10 henning Exp $ */
/* $OpenBSD: ntp.c,v 1.47 2005/01/27 10:32:29 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -199,16 +199,18 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
if (p->deadline > 0 && p->deadline < nextaction)
nextaction = p->deadline;
if (p->deadline > 0 && p->deadline <= time(NULL)) {
log_debug("no reply from %s received in time",
log_sockaddr(
(struct sockaddr *)&p->addr->ss));
timeout = scale_interval(
INTERVAL_QUERY_PATHETIC, 0.0);
log_debug("no reply from %s received in time, "
"next query %ds", log_sockaddr(
(struct sockaddr *)&p->addr->ss), timeout);
if (p->trustlevel >= TRUSTLEVEL_BADPEER &&
(p->trustlevel /= 2) < TRUSTLEVEL_BADPEER)
log_info("peer %s now invalid",
log_sockaddr(
(struct sockaddr *)&p->addr->ss));
client_nextaddr(p);
client_query(p);
set_next(p, timeout);
}
if (p->state == STATE_QUERY_SENT) {


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

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.48 2004/12/16 00:38:59 dtucker Exp $ */
/* $OpenBSD: ntpd.h,v 1.49 2005/01/27 10:32:29 dtucker Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -237,6 +237,8 @@ int client_addr_init(struct ntp_peer *);
int client_nextaddr(struct ntp_peer *);
int client_query(struct ntp_peer *);
int client_dispatch(struct ntp_peer *, u_int8_t);
time_t scale_interval(time_t, double);
void set_next(struct ntp_peer *, time_t);
/* util.c */
double gettime(void);


Loading…
Cancel
Save