Re: adding easy handles when using curl_multi_socket*
Date: Tue, 29 Apr 2008 11:06:53 +0200
Christopher Palow schrieb:
> At least in the current version of libcurl you don’t need
> to call curl_multi_socket_all() to start a connection after adding an
> easy handle to a multi handle with curl_multi_add_handle().
> Curl_multi_add_handle() starts a connection as well as adding it to a
> multi handle.
I installed curl 7.18.1,
> Likewise, in load() you then don’t need “while (CURLM_CALL_MULTI_PERFORM
> == curl_multi_socket_all(cm, &U));” after the loop of requesthandler()s.
commented line 34 and 199 ( the curl_multi_socket_all()'s),
linked it to my 7.18.1
gcc -g -levent `/opt/curl/bin/curl-config --cflags --libs` -Wl,-rpath
-Wl,/opt/curl/lib -o load load.c
linux-gate.so.1 => (0xffffe000)
libevent-1.3b.so.1 => /usr/lib/libevent-1.3b.so.1 (0xb7fb6000)
libcurl.so.4 => /opt/curl/lib/libcurl.so.4 (0xb7f79000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e2e000)
libidn.so.11 => /usr/lib/libidn.so.11 (0xb7dfd000)
libssl.so.0.9.8 => /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7dbc000)
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8
libz.so.1 => /usr/lib/libz.so.1 (0xb7c64000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7c5f000)
> In socket_callback() why do you call event_del(ev) when ev exists?
> From watching traces certainly the socket_callback seems to do the
> sequence CURL_POLL_OUT, CURL_POLL_REMOVE, then CURL_POLL_IN,
> CURL_POLL_REMOVE but I don’t think the API specifies that.
removed the ev_del and ran it
load.c:36 Added request 1
Added: 1, Finished: 0, Time: 1ms
curl_multi_add_handle did not register _any_ sockets or callbacks.
The event_del does not "free" the event record, it tells the
eventlibrary not to poll it again.
Actually this is the default for a iteration until event_add says
Received on 2008-04-29