From e0132ebc2730e6fe401edb6b25791b45f275397f Mon Sep 17 00:00:00 2001 From: Forrest <30576607+fspmarshall@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:56:04 -0700 Subject: [PATCH] improve session resumption error message (#43725) --- lib/resumption/client.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/resumption/client.go b/lib/resumption/client.go index 11c41adf86c65..4120ba2d92c19 100644 --- a/lib/resumption/client.go +++ b/lib/resumption/client.go @@ -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 }