cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: DNS Cache on Windows XP

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 23 Jul 2003 12:42:26 +0200 (CEST)

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
Received on 2003-07-23