Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/lib/libc/net pullup 1.30 -> 1.31 (approved by releng-1-5)



details:   https://anonhg.NetBSD.org/src/rev/1e65c0d6bdb3
branches:  netbsd-1-5
changeset: 488965:1e65c0d6bdb3
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Aug 07 16:53:36 2000 +0000

description:
pullup 1.30 -> 1.31 (approved by releng-1-5)

----------------------------
revision 1.31
date: 2000/07/27 00:35:02;  author: itojun;  state: Exp;  lines: +14 -6
do not try to transmit UDP DNS query forever, in EINTR-busy situation.
the change uses extra variables which can be avoided,
it is to make the change look similar to BIND8 change.
question: timeout resolution is 1 second (time_t).  should we use
timevals instead?

PR 6410 From: maximum entropy <entropy%venom.bernstein.com@localhost>

diffstat:

 lib/libc/net/res_send.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (52 lines):

diff -r fedd60c7d7af -r 1e65c0d6bdb3 lib/libc/net/res_send.c
--- a/lib/libc/net/res_send.c   Mon Aug 07 15:40:23 2000 +0000
+++ b/lib/libc/net/res_send.c   Mon Aug 07 16:53:36 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_send.c,v 1.29 2000/06/18 21:41:23 itojun Exp $     */
+/*     $NetBSD: res_send.c,v 1.29.2.1 2000/08/07 16:53:36 itojun Exp $ */
 
 /*-
  * Copyright (c) 1985, 1989, 1993
@@ -59,7 +59,7 @@
 static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: res_send.c,v 8.13 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: res_send.c,v 1.29 2000/06/18 21:41:23 itojun Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.29.2.1 2000/08/07 16:53:36 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -624,7 +624,7 @@
                        /*
                         * Use datagrams.
                         */
-                       time_t seconds;
+                       time_t seconds, now, timeout, finish;
                        struct pollfd dsfd;
                        struct sockaddr_storage from;
                        socklen_t fromlen;
@@ -734,13 +734,21 @@
                                seconds /= _res.nscount;
                        if ((long) seconds <= 0)
                                seconds = 1;
+                       now = time(NULL);
+                       timeout = seconds;
+                       finish = now + timeout;
                        dsfd.fd = s;
                        dsfd.events = POLLIN;
 wait:
-                       n = poll(&dsfd, 1, (int)(seconds * 1000));
+                       n = poll(&dsfd, 1, (int)(timeout * 1000));
                        if (n < 0) {
-                               if (errno == EINTR)
-                                       goto wait;
+                               if (errno == EINTR) {
+                                       now = time(NULL);
+                                       if (finish > now) {
+                                               timeout = finish - now;
+                                               goto wait;
+                                       }
+                               }
                                Perror(stderr, "poll", errno);
                                res_close();
                                goto next_ns;



Home | Main Index | Thread Index | Old Index