cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Aborting a transfer safely

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 17 May 2016 11:18:50 +0200 (CEST)

On Tue, 17 May 2016, MingHeng Wang wrote:

> This function returns 0 to abort this transfer. After that I remove this
> handle from the multi-handle. But sometimes my program crashes because of
> double freeing the uv_poll_t on stopping polling a socket. I'm not very
> experienced or sure if it's something of my code goes wrong. But my question
> is: will aborting a transfer by returning 0 from the write callback and
> removing a handle from a multi-handle both cause CURL_POLL_REMOVE passed to
> the socket function for the same socket?

No, it should only ever signal a single CURL_POLL_REMOVE for a single socket.

But shouldn't that be fairly easy for you to figure out if it happens? Just
add some printf() logging that outputs which sockets that are removed...

> Or how to safely abort a transfer in a multi-socket?

Transfers are aborted in the exact same way in multi-socket as in the ordinary
multi interface!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-17