cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Pausing downloads with multi interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 20 Mar 2007 16:00:39 +0100 (CET)

On Mon, 19 Mar 2007, Andrew Penner wrote:

> I have a nice app running with the multi interface that handles asynchronous
> downloads. The problem is that I cannot guarantee that my data sink will be
> able accommodate writing at the rate that write callbacks occur. To get
> around this, I implemented simple curl_multi_pause_handle and
> curl_multi_resume_handle to allow the data sink to have some control over
> what's going on with the transfer.

Sounds like a great addition that fits perfectly with what I've been wanting
to see for a long time. Does the pause affect both upload and download
simultaneously, or can you set either one independently?

> All I did was add a 'pause' flag to the SessionState structure. The
> curl_multi_perform and curl_multi_fdset functions simply ignore an easy
> handle if its pause flag is set. This actually seems to work after some
> simple tests.

... then I guess you pause both directions at once... While more complicated
to add, I think it would make sense to be able to pause either direction as I
can imagine use-cases where you want to upload and download but you only have
a "flow control" need for one of the directions.

> I am not familiar with the internals of libcurl so I am asking for help in
> identifying any flaws with this approach or steps that I may have omitted.
> (Do I need to reset and timeouts, etc?)

Please post your current work as a diff -u patch as then we can test it in our
ends and easier provide accurate comments on the approach and code.

> BTW, libcurl is a pleasure to deal with. Keep up the excellent work.

Thanks!

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