cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: DNS Cache on Windows XP

From: Tracy Boehrer <tboehrer_at_calltower.com>
Date: Wed, 23 Jul 2003 07:43:34 -0700

Yes... that worked. You da man!

-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Wednesday, July 23, 2003 5:42 AM
To: libcurl Mailing list
Subject: RE: DNS Cache on Windows XP

On Tue, 22 Jul 2003, Tracy Boehrer wrote:

> There are actually three requests happening in my test.

Ok, I think I'm starting to get a grip of what the problem might be...

> 1) The first request creates a connection and a dns entry (with a ultimate
> count of 1). This first transfer works OK, and when it's done calls
> Curl_done, which calls Curl_resolv_unlock, which decrements the inuse
> counter to 0.

This is all sane and works as it is supposed to.

> 2) The second connection reuses the previous connection, but times out.
> In addition to marking that connection as closed (conn->bits.close = TRUE),
> it also calls Curl_done, which decrements the inuse counter (now -1).

This is of course where the problem is. Since we never lookup the name, we
don't increase the 'inuse' counter... And we shouldn't use the 'connect_addr'
field in a re-used connection, as that might not be around anymore.

Can you see if this patch helps your situation:

--- lib/url.c 22 Jul 2003 11:15:46 -0000 1.288
+++ lib/url.c 23 Jul 2003 10:41:33 -0000
@@ -2901,6 +2901,8 @@
   if(conn->bits.reuse) {
     /* re-used connection, no resolving is necessary */
     hostaddr = NULL;
+ conn->connect_addr = NULL; /* we don't connect now so we don't have any
+ fresh connect_addr struct to point to */
   }
   else if(!data->change.proxy || !*data->change.proxy) {
     /* If not connecting via a proxy, extract the port from the URL, if it is

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
Received on 2003-07-23