On Sat, 25 Jan 2014, Jonathan Masters wrote:
1. If I start a connection and it never connects, how do I know this? It is not like I can get its fd from the curl multi fdset as it's not there.
Why would you need an fd to know that? You can only really detect this with a timeout or with a failure somewhere. If we rule out the failure somewhere which very well may not happen or take a very long time to happen, you're left with a timeout.
You can do a timeout two ways: you set one of the libcurl timeout options which will cause the transfer to fail if the timeout triggers, or you set a timeout yourself and yank out the easy handle if you hit the timeout.
If you do it yourself, you will of course not really know the state of your connection (we've discussed exposing the state and we had an experiemental patch a while ago) so you then basically just work on "too long time without any data delivered" or something like that.
2. If I start a connection, with tcp keepalive on, the connection is successful, then for some reason the connection is broken so there are no replies to the tcp keepalives, how do I know the connection is dead before the next request attempt?
If nothing is using the connection when it dies, then nothing will detect that it is dead until you try to find a connection again the next time (as then libcurl will close all connections it finds that are dead).
Why would you need to figure that out before next time you want a new connection?
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
