curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question about curl_multi_remove_handle()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 4 Dec 2016 01:02:20 +0100 (CET)

On Tue, 29 Nov 2016, Andreas Hollaus wrote:

> I've read that calling curl_multi_remove_handle() is the correct way to stop
> an ongoing transfer. Still, I'm curious about the callback functions
> configured for the easy handle (CURLOPT_HEADERFUNCTION &
> CURLOPT_WRITEFUNCTION).
>
> Can they still be triggered after the handle was removed, in the rare case
> that some data was previously fetched to the buffer? I do understand that no
> more data will be fetched to the buffer after the handle is removed.

I'm pretty sure there can at least not be any more data. There can potentially
be more headers so that callback can probably still get called. I don't recall
off the top of my head if we've done anything to prevent that.

> I guess that the callback functions are triggered by the curl_multi_perform()
> call, right? What if there's a task switch before the callback function is
> triggered so that another thread could call curl_multi_remove_handle(). Would
> that still stop the waiting callback function from being called?

I don't think libcurl can return back from a function call without delivering
received data to the data callback.

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