cURL / Mailing Lists / curl-library / Single Mail


Re: adding easy handles when using curl_multi_socket*

From: <>
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

  ldd load => (0xffffe000) => /usr/lib/ (0xb7fb6000) => /opt/curl/lib/ (0xb7f79000) => /lib/tls/i686/cmov/ (0xb7e2e000) => /usr/lib/ (0xb7dfd000) => /usr/lib/i686/cmov/ (0xb7dbc000) => /usr/lib/i686/cmov/
(0xb7c79000) => /usr/lib/ (0xb7c64000)
         /lib/ (0xb7fe0000) => /lib/tls/i686/cmov/ (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
> 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