cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Stoping/Aborting curl_easy_perform

From: Hardeep Nagi <shardeep13_at_yahoo.com>
Date: Fri, 10 Dec 2004 01:41:37 -0800 (PST)

Yes Deniel u right,
I tried that just now.
I have a flag which is set when abort is called. And the same flag is checked in the writedata callback, if found true , instead of sending the number of bytes received i return 0 so as to abort the connect.
But a lil confusion, this will come into effect only after the very first chunk of the transfer is returned. what if i want to abort the transfer when its just trying to connect and the request is just reaching the other end...that means between duration : after issuing curl_easy_perform and before receiving the first callback chunk for that request ?
pls let me know if there is any other way ..

Daniel Stenberg <daniel-curl_at_haxx.se> wrote:
On Thu, 9 Dec 2004, Hardeep Nagi wrote:

> Does anyone know how a curl_easy_perform can be aborted.

Yes we do!

> Scenario in my program: I create two threads. And pass the obj of my class(
> that has easy handle and manages open/send HTTP methods ) in both the
> threads. One thread is actually doing curl_easy_perform in a loop and from
> the other thread i want to abort the transfers. But I get error, What i try
> to do is i curl_easy_cleanup() that handle.

That is not the right way.

The thread that runs curl_easy_perform() must return the proper return code in
one of the callbacks to cause the transfer to abort. Or, you can set options
that makes it stop at a certain timeout time or when the transfer speed is
lower than your set limit.

-- 
Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
Dedicated custom curl help for hire: http://haxx.se/curl.html
		
---------------------------------
Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.
Received on 2004-12-10