curl-library
Where should I put post-transferring logic?
Date: Fri, 3 Jun 2011 15:42:55 -0400
I am sending files using the Curl (7.21.6) multi interface via SFTP.
I want to make sure that I perform some logic exactly once IFF the files
were transferred successfully.
So where should I place this logic?
I could place this logic in the progress_callback function. It would execute
in the case that ultotal == ulnow. Then it would set a flag so it doesn't
repeat..
Or I could place it in the read_callback function. It would execute just
before call back returned zero.
But both approaches have drawbacks:
- I'm concerned that a timing issue may cause the transfer to complete
before a progress callback happens. So it might never be called in the case
ultotal == ulnow.
- Doing the logic in the read callback isn't really a guarantee that the
file has transferred fully. The connection might break after the
read_callback returns 0 but before the last chunk of data is actually sent.
So when/where do others place this type of logic?
- Saqib
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-03