W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1999

DNS weight logic wrong

From: Klaus Weide <kweide@tezcat.com>
Date: Wed, 3 Feb 1999 10:44:13 -0600 (CST)
To: www-lib@w3.org
Message-ID: <Pine.SUN.3.95.990203090132.10636A-100000@xochi.tezcat.com>
Trying to understand the logic of the DNS cache, I found several things 
that look wrong.  First, the comparison logic in HTGetHostByName makes
it obvious that "small number" is "good".  (The comment

            double best_weight = 1e30;                        /* Pretty good */

is misleading.)  But HTDoConnect passes a negative value to 
HTDNS_updateWeigths as deltatime after a successful connect.
Fix: replace the two occurrences in HTTCP.c of

      me->connecttime -= HTGetTimeInMillis();


      me->connecttime = HTGetTimeInMillis() - me->connecttime;

Second, the values in HTTCP.c's #defines for TCP_PENALTY and TCP_DELAY
seem to be meant as seconds, but are added to me->connecttime
directly - there's a facor of 1000 missing somewhere.

Questions: HTDoConnect has

                    if (HT_HOSTUNREACHABLE(socerrno))
                        me->connecttime += TCP_DELAY;
                        me->connecttime += TCP_PENALTY;

Shouldn't that be the other way?
What are the other errors, anticipated to not be covered by

/* x seconds penalty on a multi-homed host if IP-address is timed out */

Is the code using TCP_DELAY actually reached if a conect timeout occurs?

Nit: the spelling of "Weight" in HTDNS_updateWeigths (and some trace
messages in that function) is wrong.  I only noticed when searching
for "weight" didn't find anything. :)

Received on Wednesday, 3 February 1999 11:44:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:49 UTC