cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLM_CALL_MULTI_PERFORM and curl_multi_socket

From: Nathan E. Moore <nate_at_redtetrahedron.org>
Date: Sun, 01 Jun 2008 16:02:14 -0400

--On Saturday, May 31, 2008 7:57 PM +0200 Daniel Stenberg <daniel_at_haxx.se>
wrote:
> Using 7.18.1 I presume?

Yes. I should have mentioned that.

>
> The curl_multi_socket() API is a bit broken in this version and I've done
> numerous fixes in that for the upcoming release. It would be very good if
> you could try your same code with the most recent CVS/snapshot and see if
> you get any of these problems still.
>
> I used to get the CURLM_BAD_SOCKET problem as well, and in my case it
> actually turned out to be that libevent could report action on the socket
> even though I just previously told it I wasn't interested in that socket
> anymore. That, and how CURLM_CALL_MULTI_PERFORM works/is documented, made
> me change the curl_multi_socket*() functions to now just ignore "unknown"
> file descriptors passed in.

I just tried with cvs. With the changes to ignore CURLM_BAD_SOCKET, this
obviously never happens, but if I don't ignore CURLM_BAD_SOCKET it does.

Attached is a modified copy of hiperfifo.c. The modifications: remove
ignoring CURLM_BAD_SOCKET in mcode_or_die, disable the progress callback,
and add printfs to event_cb. When run against a libcurl that will return
CURLM_BAD_SOCKET from multi_socket and that prints state change info[1]
hiperfifo terminates with:

entering event_cb
calling curl_multi_socket with fd=28
STATE: PERFORM => DONE handle 0xb80a9038; (connection #21)
socket callback: s=28 e=0xb803da78 what=REMOVE
multi_timer_cb: Setting timeout to 1 ms
calling curl_multi_socket with fd=28
ERROR: event_cb: curl_multi_socket returns CULRM_BAD_SOCKET

Nathan Moore

[1] I couldn't get the CURLDEBUG stuff to work so I just removed the ifdefs
needed for print change info and changed an infof to printf

Received on 2008-06-01