RE: windows patch and problem

2001-11-29 Thread Herold Heiko

It does.
Heiko

-- 
-- PREVINET S.p.A.[EMAIL PROTECTED]
-- Via Ferretto, 1ph  x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907087
-- ITALY



>-Original Message-
>From: Hrvoje Niksic [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, November 29, 2001 3:06 PM
>To: Wget List
>Subject: Re: windows patch and problem
>
>
>"Ian Abbott" <[EMAIL PROTECTED]> writes:
>
>> On 29 Nov 2001 at 12:48, Herold Heiko wrote:
>> 
>>> --12:27:26--  http://www.cnn.com/
>>>   (try: 3) => `www.cnn.com/index.html'
>>> Found www.cnn.com in host_name_addresses_map (008D01B0)
>>> Releasing 008D01B0 (new refcount 1).
>>> Retrying.
>>> 
>>> (ecc.)
>>> Same with other hosts
>>> 
>>> Could somebody please confirm if this is a problem with my build ?
>> 
>> No, it happens on my Linux build too. Something broke.
>
>I discovered a bug.  Does this patch help:
>
>
>2001-11-29  Hrvoje Niksic  <[EMAIL PROTECTED]>
>
>   * host.c (address_list_new): Initialize al->faulty.
>
>Index: host.c
>===
>RCS file: /pack/anoncvs/wget/src/host.c,v
>retrieving revision 1.21
>diff -u -r1.21 host.c
>--- host.c 2001/11/27 14:55:40 1.21
>+++ host.c 2001/11/29 14:05:07
>@@ -141,6 +141,7 @@
> ++count;
>   assert (count > 0);
>   al->count= count;
>+  al->faulty   = 0;
>   al->buffer   = xmalloc (count * IP4_ADDRESS_LENGTH);
>   al->refcount = 1;
> 
>



Re: windows patch and problem

2001-11-29 Thread Hrvoje Niksic

Herold Heiko <[EMAIL PROTECTED]> writes:

> Ok, fine. But, in order to avoid misunderstanding, wouldn't it be
> better to have a wrapper function (msleep ?) and use that where
> really millisecond granularity is desired ? Otherwise sooner or
> later somebody could use usleep where really microsecond granularity
> is desired,

IMO anyone who calls usleep() and expects perfect microsecond
granularity deserves what he gets.  Wget is certainly not, so using
usleep is fine.

I agre that "msleep" would make more sense with how Wget is using it,
but usleep() was already there, so I used that.  There's also a
"nanosleep", but I really hate filling out a structure just to sleep.

The other thing is, I really dislike having application-specific
wrappers for *all* OS functionality.  I know most big applications
take that route, but it doesn't mean it's necessarily a good thing.

> What I mean is, while testing that I found (like expected) with a ~
> 30kb/sec connection to the server and a --limit-rate=100 wget would read
> a whole buffer, sleep for several seconds, read another full buffer and
> so on

Yes; that's supposed to happen.  I don't think we can do much about it
in a portable fashion.  Besides, is it ever useful to limit the
bandwidth to 100 bytes/s?  Even people with 56kbps modems limit to 2
or 3 k.

> Wasn't there some time ago a bandwidth patch floating around which
> played with window sizes instead of pausing ?

I don't think so.  There was a time when I examined the
bandwidth-limiting patches, and I couldn't find any that did that.
They were just sleeping, and most of them incorrectly.



RE: windows patch and problem

2001-11-29 Thread Herold Heiko

Ok, fine. But, in order to avoid misunderstanding, wouldn't it be better
to have a wrapper function (msleep ?) and use that where really
millisecond granularity is desired ? Otherwise sooner or later somebody
could use usleep where really microsecond granularity is desired, with
undesiderabile results on some platforms wher only millisecond
granularity is available (currently windows only, ok, but still... from
a "clean code" point of view...)

The --limit-rate seems to work correctly on windows with this patch,
except obviously when the general "sleep" approach is too far from
optimal, for example a fast connection and a very low rate.

What I mean is, while testing that I found (like expected) with a ~
30kb/sec connection to the server and a --limit-rate=100 wget would read
a whole buffer, sleep for several seconds, read another full buffer and
so on; Mean bandwidth used was correctly around 100 bytes/sec, but a
bandwidth monitor showed lots of high spikes separated by pauses. It
would be interesting experimenting with something like that while on the
same pipe some or several other high bandwidth transfers are occuring.

Wasn't there some time ago a bandwidth patch floating around which
played with window sizes instead of pausing ? Probably more correct but
less portable :(

Heiko

-- 
-- PREVINET S.p.A.[EMAIL PROTECTED]
-- Via Ferretto, 1ph  x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907087
-- ITALY



>-Original Message-
>From: Hrvoje Niksic [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, November 29, 2001 3:09 PM
>To: Wget List
>Subject: Re: windows patch and problem
>
>
>Herold Heiko <[EMAIL PROTECTED]> writes:
>
>>  *  cmpt.c: provided usleep somewhat-emulation
>
>Note that your emulation is perfectly fine not only because usleep()
>is currently called with multiples of thousand, but also because Wget
>doesn't *really* depend on microsecond granularity of usleep, because
>it's not there.
>
>A good test for your usleep() is to see whether --limit-rate works.
>
>Thanks for the patch; I'm about to apply it.
>



Re: windows patch and problem

2001-11-29 Thread Hrvoje Niksic

Herold Heiko <[EMAIL PROTECTED]> writes:

>   *  cmpt.c: provided usleep somewhat-emulation

Note that your emulation is perfectly fine not only because usleep()
is currently called with multiples of thousand, but also because Wget
doesn't *really* depend on microsecond granularity of usleep, because
it's not there.

A good test for your usleep() is to see whether --limit-rate works.

Thanks for the patch; I'm about to apply it.



Re: windows patch and problem

2001-11-29 Thread Hrvoje Niksic

"Ian Abbott" <[EMAIL PROTECTED]> writes:

> On 29 Nov 2001 at 12:48, Herold Heiko wrote:
> 
>> --12:27:26--  http://www.cnn.com/
>>   (try: 3) => `www.cnn.com/index.html'
>> Found www.cnn.com in host_name_addresses_map (008D01B0)
>> Releasing 008D01B0 (new refcount 1).
>> Retrying.
>> 
>> (ecc.)
>> Same with other hosts
>> 
>> Could somebody please confirm if this is a problem with my build ?
> 
> No, it happens on my Linux build too. Something broke.

I discovered a bug.  Does this patch help:


2001-11-29  Hrvoje Niksic  <[EMAIL PROTECTED]>

* host.c (address_list_new): Initialize al->faulty.

Index: host.c
===
RCS file: /pack/anoncvs/wget/src/host.c,v
retrieving revision 1.21
diff -u -r1.21 host.c
--- host.c  2001/11/27 14:55:40 1.21
+++ host.c  2001/11/29 14:05:07
@@ -141,6 +141,7 @@
 ++count;
   assert (count > 0);
   al->count= count;
+  al->faulty   = 0;
   al->buffer   = xmalloc (count * IP4_ADDRESS_LENGTH);
   al->refcount = 1;
 



Re: windows patch and problem

2001-11-29 Thread Ian Abbott

On 29 Nov 2001 at 12:48, Herold Heiko wrote:

> --12:27:26--  http://www.cnn.com/
>   (try: 3) => `www.cnn.com/index.html'
> Found www.cnn.com in host_name_addresses_map (008D01B0)
> Releasing 008D01B0 (new refcount 1).
> Retrying.
> 
> (ecc.)
> Same with other hosts
> 
> Could somebody please confirm if this is a problem with my build ?

No, it happens on my Linux build too. Something broke.