cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Progress callback crash on return and non-blocking Qs

From: Leigh Morresi <lam_at_d2p.com.au>
Date: Wed, 15 Jun 2005 14:09:16 +1000

Ok sorry i think i got it figured out, i just set the function that handles
the
callback for the progressupdate as being a local function of the source code
rather than a member of the object.

Still, how do i make all this non-blocking?

leigh

Quoting Leigh Morresi <lam_at_d2p.com.au>:

> Hi all!
>
> just working off the form post example, have read a fair bit about adding a
> progress callback to the CURLOPT_PROGRESSCALLBACK, however i get a
> segfault/accessDenied in transfer.c, around line 1370 when it calls
> Curl_pgrsUpdate(conn), it actually errors as soon as it hits "return 0" in
> the
> Curl_pgrsUpdate function.
>
> Also, any ideas on making the whole show non-blocking so my UI can keep
> ticking
> over?
>
> Heres the code i am using..
>
> connection::connection() {
> curl_global_init(CURL_GLOBAL_ALL);
> curl_formadd(&formpost,
> &lastptr,
> CURLFORM_COPYNAME, "sendfile",
> CURLFORM_FILE, infile,
> CURLFORM_END);
> curl_formadd(&formpost,
> &lastptr,
> CURLFORM_COPYNAME, "filename",
> CURLFORM_COPYCONTENTS, infile,
> CURLFORM_END);
> curl_formadd(&formpost,
> &lastptr,
> CURLFORM_COPYNAME, "submit",
> CURLFORM_COPYCONTENTS, "send",
> CURLFORM_END);
>
> curl = curl_easy_init();
> headerlist = curl_slist_append(headerlist, buf);
> if(curl) {
> /* what URL that receives this POST */
> curl_easy_setopt(curl, CURLOPT_URL, url);
> curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
> curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
> curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
> res = curl_easy_perform(curl);
> ---
> }
>
> int connection::progress_callback(void *nothing, double dltotal, double
> dlnow,
> double ultotal, double ulnow) {
>
> return 0;
> }
>
>
> thanks
>
> leigh
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Received on 2005-06-15