curl-library
Re: Pause/Resume POST using libcurl-multi and libevent
Date: Thu, 21 Jul 2016 00:04:19 +0200 (CEST)
On Tue, 19 Jul 2016, Vivek S wrote:
> My problem is that sometimes the feed-thread fills the buffer slowly (for
> valid reasons). To handle this I need to pause the curl-transfer till the
> buffer has some data. Right now am using curl_easy_pause in
> CURLOPT_READFUNCTION callback to pause the transfer when buffer is empty
You're actually calling curl_easy_pause() from witin the callback instead of
returning CURL_READFUNC_PAUSE ? I'm not sure that's a good idea...
> and trying to resume the transfer whenever the buffer has some data in
> CURLOPT_XFERINFOFUNCTION callback. But according the libcurl document,
> CURLOPT_XFERINFOFUNCTION callback wont be called in case of multi-curl
> interface when there is no transfer on the fd/handle. So the resume never
> happens.
When you're using the multi interface you don't need to wait for a
CURLOPT_XFERINFOFUNCTION callback, you can just call curl_easy_pause() at any
point when you think it is suitable for libcurl to continue the transfer.
> I would like to know how to resume the curl transfer(upload) when the
> buffer has some data.
Call curl_easy_pause() immediately when you have data!
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2016-07-21