cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to list easy handles from a multi handle

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 8 Jun 2016 23:27:15 +0200 (CEST)

On Wed, 8 Jun 2016, Jeroen Ooms wrote:

> Suppose you implement a browser-like application where async (e.g. ajax)
> requests are continuously added to a global multi handle. Suppose you
> implement one multi-handle per browser tab. Now if the user closes the tab,
> we need to cleanup the multi handle and "pending" easy-handles from that
> multi handle.
>
> Is the recommended approach to keep track of this ourselves by implementing
> a double-linked list of easy handles in C, in which we manually append and
> remove pointers to the easy handles when they are added/removed to the multi
> handle?

Yeps. As libcurl doesn't provide you with the list of added handles[*], you
either maintain your own list or don't care about them until libcurl tells you
about the completed ones.

Suppose you instead implement the imaginary browser with all tabs using the
same multi handle, how would you know which easy handles to remove for one of
the tabs?

[*] = with any currently existing API. As mentioned before we can always
discuss adding missing functionality.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-08