cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: new multi interface functions, continued

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 10 Mar 2005 08:40:42 +0100 (CET)

On Thu, 10 Mar 2005, Jamie Lokier wrote:

>> typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
>> curl_socket_t s, /* socket */
>> int what, /* see above */
>> void *userp); /* "private" pointer */
>
> The callback is passed the CURL* easy handle. (Why?)

As a part of a greater plan - where all callbacks get that passed in, for
convencience when an easy-function is to be used and for identifying which
handle this callback concerns.

>> CURLMcode curl_multi_socket(CURLM *multi_handle
>> curl_socket_t s,
>> int what);
>
> Given that you've passed the CURL* easy handle to the application's event
> callback, why not have the event loop call curl_multi_socket() with the easy
> handle instead of the file descriptor?
>
> Then you wouldn't need a hash table.

Indeed we could. It would put the hash (or equivalent) requirement in the app
end instead. Should we perhaps allow either socket OR easy handle? As in:

CURLMcode curl_multi_socket(CURLM *multi_handle
                             curl_socket_t s,
                             CURL *easy_handle,
                             int what);

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-03-10