connecting to non-responding hosts: 1 hr timeout (fwd)

Dave Dykstra dwd at bell-labs.com
Fri May 4 03:34:23 EST 2001


On Wed, May 02, 2001 at 09:47:51PM +0200, Gert Doering wrote:
> Hi,
> 
> On Tue, May 01, 2001 at 08:37:38PM -0700, Carson Gaspar wrote:
> [..]
> > >> you just need to do fcntl(fd, F_SETFL, O_NONBLOCK) on the socket before
> > >> the connect(), check for EINPROGRESS from the connect(), and then do a
> > >> select() for writability on the fd with a timeout of however long you
> 
> What's wrong with just alarm()ing out of the connect()?
> 
> (This will be bad for anything remotely multi-threaded but for the ssh
> client, it should be fine).


The alarm signal does not interrupt connect() on Linux (2.2.18 at least).
It does interrupt connect() with an EINTR error on Solaris though (2.7 at
least).  I'm not sure about other systems.

- Dave Dykstra



More information about the openssh-unix-dev mailing list