Subject: Re: Two questions: 1. Callback function not called; 2. TCP connecting to un-existing server prevents from using existing server.

Re: Two questions: 1. Callback function not called; 2. TCP connecting to un-existing server prevents from using existing server.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 9 Aug 2007 11:18:32 +0200 (CEST)

On Wed, 8 Aug 2007, Anlin Zhang wrote:

> Problem 1: Not all queries get callback after calling 200 ares_query(). UDP
> packets might lost but shouldn't there be a callback informing timeout? Or
> do I need set some channel options to get all callbacks?

I would assume you should get timeouts and not just not get anything. Sounds
like a bug to me.

> Problem 2: If force "Always use TCP" and primary DNS host machine is
> shut-down, tcp setup to primary DNS server takes more than a minute to give
> up before trying to connect to Secondary DNS server

Sounds like a flaw there. Possibly we should introduce some kind of time-out
option tell how long c-ares should wait for a connect to succeed before giving
up...

> I did a fix of this problem 2 by checking if the FD is really connected
> before queue the query to the connection. How to detect if the connection is
> setup of not? I simply call the unblocking connect again.

I don't really see how this approach is covering all cases. First, a very slow
connect would also need to be able to get cancelled, or even if the connect is
done fine and then just the following TCP packages take a hundred years... Or
am I wrong?

BTW, can you provide your suggested fix(es) as a diff -u output?

-- 
   c-ares -- my preferred DNS asynch resolver library
Received on 2007-08-09