curl-library
Re: multi-interface and multiple addresses
Date: Mon, 14 Jun 2004 10:03:58 +0200 (CEST)
On Sun, 13 Jun 2004, Gisle Vanem wrote:
> I'm not sure if it was my connect.c patch that broke the mult-interface. But
> a modified version of multi-single.c example doesn't work:
...
> It tries a connect to the 1st host-address. But failing this (timeout), it
> never tries the other 6 addresses and gets stuck in WAITCONNECT state.
I think this is a bug that was already present before you modified that
connect stuff.
Darnit Gisle, you're indeed finding lots of bugs these days! ;-)
I fear that the fix for this problem is somewhat more complicated than how it
works for the easy interface. The multi interface's asynch nature makes it
trickier.
> It exits after 10sec though. Which multi-app.c does not? I don't see the big
> difference of those.
Given a quick glance just now, I admit I can't explain that difference either.
> I'm a newbie to this multi-interface, so I have just a faith idea on how to
> fix this; If 'set.connecttimeout / num_addr' has elapsed while in
> CURLM_STATE_WAITCONNECT, shouldn't it try the next address somehow?
Yes it should. It should remember what IP it tried and failed to connect to,
and then try the next one until all are tested or the time is out.
> My idea is kind of messy, but is to have Curl_is_connected() return a list
> of other address to try on failure. Or call Curl_connecthost() again, but
> now with the next address. Ideas?
In multi.c, we call Curl_connect() to do the connect and when
Curl_is_connected() returns error (while we are in the CURLM_STATE_WAITCONNECT
state) we know the connection failed.
I think it would make sense to provide a function like Curl_trynextip() that
would then be invoked, and if there's another IP known for the host name, it
starts trying to connect to that one instead (while remaining in the
CURLM_STATE_WAITCONNECT state).
Curl_trynextip() would remember what IP number it tried the last time and try
the last + 1 now.
Does that make sense?
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-06-14