Handling of failed connect()s when ssh-agent is busy

Gert Doering gert at greenie.muc.de
Tue Feb 13 05:27:41 EST 2001


Hi,

On Mon, Feb 12, 2001 at 10:19:55AM -0800, Jos Backus wrote:
> > [..]
> > > We fixed SSH-1.2.27 by wrapping this part of the code in a while-loop (looping
> > > if errno == ECONNREFUSED), and this appears to work well, solving our
> > > immediate problem.
> > 
> > Hmmm.  What happens if the agent is not running at all, but the socket
> > exists (leftover, for example, after the agent has died for whatever
> > reason)?
> 
> I thought about that too. Isn't there a way to distinguish between these
> cases? We clearly only want to retry when we have reason to believe that the
> agent is indeed still listening.

To my knowledge, no - if the socket exists, but nothing is there,
ECONNREFUSED *is* the error message to be returned...

What I'd do is to try, say, 10 times, with a random delay in between,
something like "10-20 ms" or so - to give the agent time to recover if too
many ssh clients are beating onto it.  If it didn't work in 10 times, give
up.

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert at greenie.muc.de
fax: +49-89-35655025                        gert.doering at physik.tu-muenchen.de





More information about the openssh-unix-dev mailing list