From owner-freebsd-bugs Thu Aug 17 10: 7:48 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from onion.ish.org (onion.ish.org [210.145.219.202]) by hub.freebsd.org (Postfix) with ESMTP id D580137B821 for ; Thu, 17 Aug 2000 10:06:58 -0700 (PDT) Received: from localhost (ishizuka@localhost [127.0.0.1]) by onion.ish.org (8.9.3/3.7Wpl2-2000/05/28) with ESMTP id CAA26690; Fri, 18 Aug 2000 02:06:49 +0900 (JST) To: ume@mahoroba.org Cc: FreeBSD-bugs@freebsd.org Subject: Re: bin/20613: fetch -T n is not timeout correctly In-Reply-To: <20000817.025250.74742437.ume@mahoroba.org> References: <20000817.025250.74742437.ume@mahoroba.org> X-Mailer: Mew version 1.94.2 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) X-PGP-Fingerprint20: 276D 697A C2CB 1580 C683 8F18 DA98 1A4A 50D2 C4CB X-PGP-Fingerprint16: C6 DE 46 24 D7 9F 22 EB 79 E2 90 AB 1B 9A 35 2E X-PGP-Public-Key: http://www.ish.org/pgp-public-key.txt X-URL: http://www.ish.org/ Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20000818020648U.ishizuka@onion.ish.org> Date: Fri, 18 Aug 2000 02:06:48 +0900 From: Masachika ISHIZUKA X-Dispatcher: imput version 20000414(IM141) Lines: 41 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >>>Description: >> >> % fetch -T 5 http://www.hoge.com/index.html >> >> When server 'www.hoge.com' is down or can't lookup address from >> DNS server, fetch command is not timeout with 5 seconds. >> Older version of fetch (with 4.0R or 3.4R) is timeout with 5 seconds. > > I cannot realize this problem with accessing > http://www.hoge.com/index.html. However, I heared from you that > fetching to the server where is actually not exist something like > "fetch -T 1 http://10.1.1.1/aaa.txt" causes this problem. > Is this patch fix your problem? > > Index: lib/libfetch/common.c > diff -u lib/libfetch/common.c.orig lib/libfetch/common.c > --- lib/libfetch/common.c.orig Tue Jul 18 07:01:26 2000 > +++ lib/libfetch/common.c Thu Aug 17 02:36:42 2000 > @@ -201,7 +201,12 @@ > if ((sd = socket(res->ai_family, res->ai_socktype, > res->ai_protocol)) == -1) > continue; > - if (connect(sd, res->ai_addr, res->ai_addrlen) != -1) > + if (fetchTimeout) > + alarm(fetchTimeout); > + err = connect(sd, res->ai_addr, res->ai_addrlen); > + if (fetchTimeout) > + alarm(0); > + if (err != -1) > break; > close(sd); > sd = -1; Hi, this is ishizuka. Thank you very much. This patch fixed my problem. And, sorry to say that I wrote 'www.hoge.com' to mean 'some.nonexist.domain.or.server' but this domain and this server really exists. -- ishizuka@ish.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message