cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi interface doesn't recognize when can't connect

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Feb 2003 08:50:19 +0100 (CET)

On Sun, 9 Feb 2003, Martin C. Martin wrote:

> But in reality, if select() leaves the file descriptor in the list of error
> descriptors, waitconnect() returns 2. This is happening to me on
> Windows/MSVC when there's nothing to connect to.

Aha! I wasn't aware of this. Silly me. Nice catch and good digging!

> Curl_is_connected() ignores this return value (along with -1 and 1) and
> seems to assume its still connecting.
>
> So, if I understand correctly, after the "if (0 == rc)" there should be an
> "else if (rc != 1) return CURLE_COULDNT_CONNECT;" But, I'm not really a
> network programmer so I leave the fix to you.

So, if you do that fix (shown below as well), does it work as assumed for
you?

--- connect.c 4 Feb 2003 23:48:46 -0000 1.49
+++ connect.c 14 Feb 2003 07:47:40 -0000
@@ -409,6 +409,8 @@
     if(err)
       return CURLE_COULDNT_CONNECT;
   }
+ else if(2 == rc)
+ return CURLE_COULDNT_CONNECT;

   /*
    * If the connection phase is "done" here, we should attempt to connect

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
Received on 2003-02-14