ssh client does not timeout if the network fails after ssh_connect but before ssh_exchange_identification, even with Alive options set

Jiaying Zhang jiayingz at
Fri Jul 27 10:03:53 EST 2007

On 7/26/07, Dan Yefimov <dan at> wrote:
> On Thu, 26 Jul 2007, Jiaying Zhang wrote:
> > I was thinking to record the start time and subtract the elapsed time
> > when an interrupt happens.
> >
> How were you going to determine the elapsed time? Only Linux, AFAIK,
> returns
> the remaining timeout (correct me if I'm wrong).

I was thinking to record the start time with gettimeofday and check the
current time with it when we set the select timer.  If server_alive_interval
* server_alive_count_max - (current_time - start_time) is shorter than
server_alive_interval, we set timer to that value instead. But since we do
not expect the timeout to be very accurate, we can save that trouble.


> But still, when options.server_alive_count_max=1, we should exit after the
> > first timeout.
> >
> Yes, we should since, as you pointed out, options.server_alive_count_max=1:-)
> --
>     Sincerely Your, Dan.

More information about the openssh-unix-dev mailing list