cURL / Mailing Lists / curl-library / Single Mail

curl-library

Pausing downloads with multi interface

From: Andrew Penner <ampenner_at_gmail.com>
Date: Mon, 19 Mar 2007 17:28:07 -0500

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.

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.

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?)

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

Thanks,
Andrew
Received on 2007-03-19