Skip to content

Commit

Permalink
improve session resumption error message (#43725)
Browse files Browse the repository at this point in the history
  • Loading branch information
fspmarshall authored Jul 2, 2024
1 parent de73767 commit e0132eb
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/resumption/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,21 @@ func dialResumable(ctx context.Context, token resumptionToken, hostID string, re
return nil, trace.Wrap(err)
}

// success case
if responseTag == successServerExchangeTag {
return conn, nil
}

// all other tags are failure cases
_ = conn.Close()
switch responseTag {
case notFoundServerExchangeTag:
logrus.Error("Server responded with 'resumable connection not found', giving up.")
case badAddressServerExchangeTag:
logrus.Error("Server responded with 'bad client IP address', giving up.")
default:
logrus.Errorf("Received unknown response tag %v, giving up.", responseTag)
conn.Close()
return nil, nil
case notFoundServerExchangeTag, badAddressServerExchangeTag:
logrus.Errorf("Received error tag %v, giving up.", responseTag)
conn.Close()
return nil, nil
case successServerExchangeTag:
return conn, nil
logrus.Errorf("Server responded with an unknown error tag (%v), giving up.", responseTag)
}

return nil, nil
}

0 comments on commit e0132eb

Please sign in to comment.