cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: adding easy handles when using curl_multi_socket*

From: <koettermarkus_at_gmx.de>
Date: Tue, 29 Apr 2008 23:31:35 +0200

Hi Daniel,

thanks for your time.

Daniel Stenberg schrieb:
> That libcurl function can and will deal with multiple connections so the
> CURLM_CALL_MULTI_PERFORM may be due to things happening on other
> connections/sockets!#

I hope curl_multi_socket_action won't return CURLM_CALL_MULTI_PERFORM
for actions on other sockets than the one I passed.

In this case, I only have a single connection at a time, therefore this
is not causing of the problem anyway.

> But yeah, it will of course lead to the function
> being called on the same socket again and then you'll get a return code
> back since that socket is then closed already! :-/

Not closed, just not in the hashtable any longer?

> Is this situation easy for you to repeat? I'm not sure what the best fix
> for this is: A) make that return code not happen when the specific
> socket passed in has been removed or B) deal with the subsequent call on
> a deleted socket in a better way or C) something else.

singlesocket() removes the socket and calls the socket_cb, if
singlesocket removed the socket, do not return CURLM_CALL_MULTI_PERFORM.

Either give singlesocket a return value, or use the hash table to verify
the socket still exists in curl_multi_socket_action.

> If it can be repeated, it could be used as a basis to try out a few
> alternative fixes.

Define repeat,
sometimes it comes up within seconds, then it takes minutes.
I already setup my own httpd so ebay does not suffer too much traffic ;).

If you need code to reproduce, I can sent you mine, it is short.

> Do note that load.c is not an official example source code from us. The
> official ones are in the docs/examples directory and we try to make
> those accurate and functional. We can't take responsibility for other
> source codes floating around.

Yes, but I found nothing else using the multi_socket api, therefore ...
And another thing is, we found a bug.
And once this one is fixed, I'll come up with another bug using the same
code base (proof that curl_multi_handle_add does not *always* sets a
timeout).

Once we are done, you should consider writing a public code example
using libevent and libcurl, this is really great stuff.
If you want me to, I'd be glad to contribute.

MfG
Markus
Received on 2008-04-29