cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: question about curl_multi_socket

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 6 Jan 2006 20:21:47 +0100 (CET)

On Fri, 6 Jan 2006, Sun Yi-Ming wrote:

> the curl_socket_callback mechanism is what exactly users need, depend on
> this routine, users have a fine control on all their descriptors.

That is certainly the general idea!

> but in applications, users always add, remove, or just reload a easy handle,
> on that condition, does the users must always call curl_multi_socket_all to
> renew their descriptor tables?

Ah, what an excellent question! This is certainly a flaw in how the API
currently works! We don't want to force such a call to
curl_multi_socket_all().

> or there must be container to list all the new added,removed,reloaded easy
> handles? so, even when call curl_multi_socket, these events
> (add/remove/reload) will be signaled. oh, perhaps that's urgly.

Hm. I *think* we can solve the problem like this:

1 - We set the socket callback with a new curl_multi_setopt() function (in
     similar style how callbacks are set for easy handles). We would then of
     course remove the callback arguments from the *socket() and *socket_all()
     functions.

2 - When an app removes an easy handle from a multi handle and thus the
     sockets no longer are used by libcurl it calls the callback accordingly to
     mark them as removed.

What do you say about that approach?

And thanks a lot for reviewing and sharing your thoughts on the API with us!

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-01-06