curl-library
curl_multi_perform and write_callback
Date: Mon, 17 Nov 2014 15:10:17 -0800
Hi! I'm new to libcurl.
It is unclear to me if a single call to curl_multi_perform() will
always result in at most one callback call to write_callback, or if a
single curl_multi_perform can actually invoke the callback multiple
times.
Context: I implemented a basic streaming client which uses a
write_callback that simply stores data in a fixed size buffer. The
application then repeatedly calls curl_multi_perform followed by
reading the data from the buffer, if any.
Things worked great until I enabled CURLOPT_ACCEPT_ENCODING. Now I am
running into problems, that seem to be caused by the fact that the
callback gets triggered multiple times for a single
curl_multi_perform. As a result, data from the first callback gets
overwritten by the second before it gets processed.
I am unsure if there is a bug somewhere, or if this is expected when
the network speed outruns the processing (I guess gzip introduced some
cpu overhead). And if so, what is a good technique to make sure that
write_callback is only invoked once per curl_multi_perform, to give me
a chance to read the data without having to keep growing the buffer?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-18