bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] need some advice for 0 timeout code


From: Tim Ruehsen
Subject: Re: [Bug-wget] need some advice for 0 timeout code
Date: Tue, 15 May 2012 11:26:04 +0200
User-agent: KMail/1.13.7 (Linux/3.2.0-2-amd64; KDE/4.7.4; x86_64; ; )

Am Tuesday 15 May 2012 schrieb Hrvoje Niksic:
> Tim Ruehsen <address@hidden> writes:
> > There are three obvious ways to fix the issue once and for all:
> > a)
> > when given the timeout value 0, use INFINITY and special handle this
> > value in select_fd() to call select with timeout NULL.
> 
> Why call select() or select_fd() at all when timeout is 0?

Some parts in the source call select_fd() with timeout==0, supposed to return 
immediately with -1, 0 or 1. Changing select_fd() simply won't work. I wrote 
more about that in my answer to Guiseppe's reply.

> Wget is
> supposed to simply use blocking reads when opt.read_timeout is 0
> (i.e. infinity).  poll_internal gets this right and skips the call to
> the actual poller if the timeout is 0.
> 
> One can think of 0-means-infinity as a high-level feature of functions
> aware of opt.read_timeout and similar configuration options, so the
> special handling of 0 (or another infinity marker) needs happen at that
> point.  In this design the low-level functions should just call select()
> or equivalent with the correct arguments.

That's the way it should be (just straight forward). But without changing 
well-tested code (that ex- or implicitely calls select_fd), it can't be done.

Maybe I am wrong and someone comes with the 'voila' one-liner that fixes the 
issue.

Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]