[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Non-blocking HTTP request with socket.http and copas
- From: Paul K <paul@...>
- Date: Sun, 27 Jul 2014 23:20:55 +0000
Hi Adam,
> That's because connect() includes a DNS lookup, and DNS resolution on
> Windows is synchronous. Most programs work around this problem using
> threads. It's kinda lame.
Yes, I thought it blocks somewhere in the resolver. There is not much
I can do at the application level. Fortunately in my case I only have
to deal with known addresses.
> What's the expected behavior of a zero timeout? I would expect it to
> never succeed at all, because no packet ever has zero latency.
It would be the same as for a small timeout; I'd expect "nil, timeout"
to be returned with copas taking care of that. Even using 0.000001 as
the timeout value works, but not 0.
Paul.
On Sun, Jul 27, 2014 at 4:01 PM, Coda Highland <chighland@gmail.com> wrote:
> On Sun, Jul 27, 2014 at 3:55 PM, Paul K <paul@zerobrane.com> wrote:
>> It works well for me on Windows, but still blocks on requests for
>> non-existing addresses.
>
> That's because connect() includes a DNS lookup, and DNS resolution on
> Windows is synchronous. Most programs work around this problem using
> threads. It's kinda lame.
>
>> The current logic also doesn't work when http.TIMEOUT is set to 0
>> instead of a small non-zero value. The result is still sufficiently
>> good for me, but I'd be interested to know how to make it work for 0
>> timeout as well.
>
> What's the expected behavior of a zero timeout? I would expect it to
> never succeed at all, because no packet ever has zero latency.
>
> /s/ Adam
>