Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/lib/libc/net Pull up revision 1.31 (requested by itojun):
details: https://anonhg.NetBSD.org/src/rev/78e5857d1b4a
branches: netbsd-1-4
changeset: 470861:78e5857d1b4a
user: he <he%NetBSD.org@localhost>
date: Tue Aug 15 21:41:26 2000 +0000
description:
Pull up revision 1.31 (requested by itojun):
Do not try to retransmit forever in EINTR-busy situation.
Fixes PR#6410.
diffstat:
lib/libc/net/res_send.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (52 lines):
diff -r b9b9f94eaf12 -r 78e5857d1b4a lib/libc/net/res_send.c
--- a/lib/libc/net/res_send.c Tue Aug 15 21:37:36 2000 +0000
+++ b/lib/libc/net/res_send.c Tue Aug 15 21:41:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: res_send.c,v 1.16 1998/11/15 17:40:38 christos Exp $ */
+/* $NetBSD: res_send.c,v 1.16.2.1 2000/08/15 21:41:26 he 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.16 1998/11/15 17:40:38 christos Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.16.2.1 2000/08/15 21:41:26 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -497,7 +497,7 @@
/*
* Use datagrams.
*/
- time_t seconds;
+ time_t seconds, now, timeout, finish;
struct pollfd dsfd;
struct sockaddr_in from;
int fromlen;
@@ -602,13 +602,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