Skip to content

Commit

Permalink
support android retries
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Oct 18, 2020
1 parent cd6468c commit a9cecff
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/client_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,19 @@ func (c *Client) connectionOnce(ctx context.Context) (connected, retry bool, err
c.Debugf("Handshaking...")
sshConn, chans, reqs, err := ssh.NewClientConn(conn, "", c.sshConfig)
if err != nil {
if strings.Contains(err.Error(), "unable to authenticate") {
e := err.Error()
if strings.Contains(e, "unable to authenticate") {
c.Infof("Authentication failed")
c.Debugf(err.Error())
c.Debugf(e)
retry = false
} else if strings.Contains(e, "connection abort") {
c.Infof("retriable: %s", e)
retry = true
} else if n, ok := err.(net.Error); ok && !n.Temporary() {
c.Infof(err.Error())
c.Infof(e)
retry = false
} else {
c.Infof("retriable: %s", err.Error())
c.Infof("retriable: %s", e)
retry = true
}
return false, retry, err
Expand Down

0 comments on commit a9cecff

Please sign in to comment.