From c996b77da329362396948cfa3574c52e15fa3c7f Mon Sep 17 00:00:00 2001 From: Eygin Semen Leonidovich Date: Wed, 9 Nov 2022 16:19:44 +0300 Subject: [PATCH] Mark connection as not good when error on cancellation confirmation --- mssql.go | 2 ++ token.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mssql.go b/mssql.go index fbd44d1f..f8f1d177 100644 --- a/mssql.go +++ b/mssql.go @@ -228,6 +228,8 @@ func (c *Conn) checkBadConn(ctx context.Context, err error, mayRetry bool) error return nil case io.EOF: c.connectionGood = false + case ErrorCancelConfirmation: + c.connectionGood = false case driver.ErrBadConn: // It is an internal programming error if driver.ErrBadConn // is ever passed to this function. driver.ErrBadConn should diff --git a/token.go b/token.go index 61c88fcb..7689e054 100644 --- a/token.go +++ b/token.go @@ -85,6 +85,8 @@ const ( // TODO implement more flags ) +var ErrorCancelConfirmation = errors.New("did not get cancellation confirmation from the server") + // interface for all tokens type tokenStruct interface{} @@ -934,7 +936,7 @@ func (t tokenProcessor) nextToken() (tokenStruct, error) { } // we did not get cancellation confirmation, something is not // right, this connection is not usable anymore - return nil, errors.New("did not get cancellation confirmation from the server") + return nil, ErrorCancelConfirmation } }