Browse Source

Found that even if client fd (i.e to NTP source) is set to

-1 because of error, it may still participate in poll()
causing poll() to repeatedly wake up on error fd.
so make sure w edon't add -1 fds to pollevents to avoid unnecessary wakeups
From: amandal@entrisphere.com
OPENBSD_4_1
henning 18 years ago
parent
commit
431920cccf
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/usr.sbin/ntpd/ntp.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.91 2006/07/01 18:52:46 otto Exp $ */
/* $OpenBSD: ntp.c,v 1.92 2006/10/21 07:30:58 henning Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -243,7 +243,8 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf)
set_next(p, timeout); set_next(p, timeout);
} }
if (p->state == STATE_QUERY_SENT) {
if (p->state == STATE_QUERY_SENT &&
p->query->fd != -1) {
pfd[i].fd = p->query->fd; pfd[i].fd = p->query->fd;
pfd[i].events = POLLIN; pfd[i].events = POLLIN;
idx2peer[i - idx_peers] = p; idx2peer[i - idx_peers] = p;


Loading…
Cancel
Save