Skip to content

Commit

Permalink
Mark connection as not good when error on cancellation confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Eygin Semen Leonidovich committed Nov 9, 2022
1 parent ed0f620 commit c996b77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mssql.go
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion token.go
Expand Up @@ -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{}

Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit c996b77

Please sign in to comment.