cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Canceling transfers with multi interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 16 Mar 2007 22:54:20 +0100 (CET)

On Fri, 16 Mar 2007, Andrew Penner wrote:

> My question is: how do I cancel transfers while they are in progress?

Pull out the easy handle with curl_multi_remove_handle()!

> Technically, I can make the download stop by returning the appropriate value
> from the write callback or the progress callback, but there are two issues:
>
> 1. Initiating the cancel from the callback function causes dozens of
> tcp resets to occur. This doesn't seem normal.

Really? That sounds like some sort of bug to me!

> 2. The man pages say that this method is not recommended for programs using
> the multi interface.

Right, but that's only because when you use the multi interface there's no
need to use the progress callback to get info about what happens and when to
break, as you can do that at any time within your own appp instead and just
remove the handle if you want a particular transfer to stop.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-03-16