At practically 2008-03-11 12:13 +0100, Marek Jarycki articulated:
I'm using 3.26 version of stunnel. How to disallow creating local sockets (on client side) when remote (server) is not available? My application detects socket creation errors and it works without stunnel, but in stunnel the socket is always opening correctly so I have to wait for timeouts to discover network disconnection.
Stunnel is sitting in accept(2) waiting for a peer to connect. accept is a kernel system call, and it doesn't have the ability to do something like "let me know when a connection could be ready so I can verify if I can connect to my remote side before you do the actual accept". If you'r in accept, you will get your first chance to do anything after the TCP handshake is done.
You need to adjust your code to deal with the fact that stunnel may be there, but the service to which stunnel is connecting you isn't.
Also, upgrade to Stunnel v4.