cURL / Mailing Lists / curl-library / Single Mail

curl-library

Immediately Stopping Ongoing Transfers

From: Saqib Ali <saqib.ali.75_at_gmail.com>
Date: Tue, 8 Mar 2011 14:10:29 -0500

I'm interested in interrupting and immediately stopping all ongoing uploads
being done through the multi-interface.

In this post back in 2002 http://curl.haxx.se/mail/archive-2002-12/0056.html,
Daniel said that there is no way to immediately do this other than to use a
callback function (such as the progress callback function.). Is that still
the case?

The docs on the progresscallback function say (
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html): "This function gets
called by libcurl instead of its internal equivalent with a frequent
interval during operation (roughly once per second or sooner)". Is there any
way to control this interval?

Alternative #1, I could set a read callback function which uploads very
small chunks at a time. And then return 0 when I wanted to stop
transferring.

Alternative #2, I could spawn a new thread, do a multi_curl_perfom (or
easy_curl_perform) in that thread. When I want to stop that transfer, I
could send a Signal to the thread that would cause it to kill itself.

What is the most commonly used approach to this problem?

- Saqib

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-08