From 042700aed2e5f709c3a7ff7c00dc009c6488f024 Mon Sep 17 00:00:00 2001 From: henning <> Date: Sat, 10 Jul 2004 19:09:13 +0000 Subject: [PATCH] check wether we have enough data to form a peer update on receiption of each packet, not only after each 8th (where we have enough for sure) --- src/usr.sbin/ntpd/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/usr.sbin/ntpd/client.c b/src/usr.sbin/ntpd/client.c index f1ea2f81..9c7de3fe 100644 --- a/src/usr.sbin/ntpd/client.c +++ b/src/usr.sbin/ntpd/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.21 2004/07/10 18:47:49 henning Exp $ */ +/* $OpenBSD: client.c,v 1.22 2004/07/10 19:09:13 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -202,14 +202,14 @@ client_dispatch(struct ntp_peer *p) p->trustlevel++; } + client_update(p); + log_debug("reply from %s: offset %f delay %f, " "next query %ds", log_sockaddr((struct sockaddr *)&fsa), p->reply[p->shift].offset, p->reply[p->shift].delay, interval); - if (++p->shift >= OFFSET_ARRAY_SIZE) { + if (++p->shift >= OFFSET_ARRAY_SIZE) p->shift = 0; - client_update(p); - } return (0); } @@ -243,7 +243,7 @@ client_update(struct ntp_peer *p) best = i; } - if (good == 0) + if (good < 8) return (-1); memcpy(&p->update, &p->reply[best], sizeof(p->update));