diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-01-27 10:32:30 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-01-27 10:32:30 +0000 |
commit | 678ecb374eb0e903b8daf773f473b62ed7faa29a (patch) | |
tree | 6cb7fd9dea708848e182b89fc8fa795004251f78 | |
parent | cd73d444d0626437ed91e86b43aea4bff4f5921b (diff) |
Delay before retrying a query on timeout; ok henning@
-rw-r--r-- | usr.sbin/ntpd/client.c | 4 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 12 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 4 |
3 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c index cf8f7adad44..139cd309779 100644 --- a/usr.sbin/ntpd/client.c +++ b/usr.sbin/ntpd/client.c @@ -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) diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 85fad772fa4..76ef10c5e24 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -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) { diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index b6b90bcdb46..64ddb9a18e7 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -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); |