@@ -104,7 +104,7 @@ func (mc *mysqlConn) Begin() (driver.Tx, error) {
104
104
}
105
105
106
106
func (mc * mysqlConn ) begin (readOnly bool ) (driver.Tx , error ) {
107
- if mc .closed .IsSet () {
107
+ if mc .closed .Load () {
108
108
errLog .Print (ErrInvalidConn )
109
109
return nil , driver .ErrBadConn
110
110
}
@@ -123,7 +123,7 @@ func (mc *mysqlConn) begin(readOnly bool) (driver.Tx, error) {
123
123
124
124
func (mc * mysqlConn ) Close () (err error ) {
125
125
// Makes Close idempotent
126
- if ! mc .closed .IsSet () {
126
+ if ! mc .closed .Load () {
127
127
err = mc .writeCommandPacket (comQuit )
128
128
}
129
129
@@ -137,7 +137,7 @@ func (mc *mysqlConn) Close() (err error) {
137
137
// is called before auth or on auth failure because MySQL will have already
138
138
// closed the network connection.
139
139
func (mc * mysqlConn ) cleanup () {
140
- if ! mc .closed .TrySet (true ) {
140
+ if mc .closed .Swap (true ) {
141
141
return
142
142
}
143
143
@@ -152,7 +152,7 @@ func (mc *mysqlConn) cleanup() {
152
152
}
153
153
154
154
func (mc * mysqlConn ) error () error {
155
- if mc .closed .IsSet () {
155
+ if mc .closed .Load () {
156
156
if err := mc .canceled .Value (); err != nil {
157
157
return err
158
158
}
@@ -162,7 +162,7 @@ func (mc *mysqlConn) error() error {
162
162
}
163
163
164
164
func (mc * mysqlConn ) Prepare (query string ) (driver.Stmt , error ) {
165
- if mc .closed .IsSet () {
165
+ if mc .closed .Load () {
166
166
errLog .Print (ErrInvalidConn )
167
167
return nil , driver .ErrBadConn
168
168
}
@@ -295,7 +295,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
295
295
}
296
296
297
297
func (mc * mysqlConn ) Exec (query string , args []driver.Value ) (driver.Result , error ) {
298
- if mc .closed .IsSet () {
298
+ if mc .closed .Load () {
299
299
errLog .Print (ErrInvalidConn )
300
300
return nil , driver .ErrBadConn
301
301
}
@@ -356,7 +356,7 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro
356
356
}
357
357
358
358
func (mc * mysqlConn ) query (query string , args []driver.Value ) (* textRows , error ) {
359
- if mc .closed .IsSet () {
359
+ if mc .closed .Load () {
360
360
errLog .Print (ErrInvalidConn )
361
361
return nil , driver .ErrBadConn
362
362
}
@@ -450,7 +450,7 @@ func (mc *mysqlConn) finish() {
450
450
451
451
// Ping implements driver.Pinger interface
452
452
func (mc * mysqlConn ) Ping (ctx context.Context ) (err error ) {
453
- if mc .closed .IsSet () {
453
+ if mc .closed .Load () {
454
454
errLog .Print (ErrInvalidConn )
455
455
return driver .ErrBadConn
456
456
}
@@ -469,7 +469,7 @@ func (mc *mysqlConn) Ping(ctx context.Context) (err error) {
469
469
470
470
// BeginTx implements driver.ConnBeginTx interface
471
471
func (mc * mysqlConn ) BeginTx (ctx context.Context , opts driver.TxOptions ) (driver.Tx , error ) {
472
- if mc .closed .IsSet () {
472
+ if mc .closed .Load () {
473
473
return nil , driver .ErrBadConn
474
474
}
475
475
@@ -636,7 +636,7 @@ func (mc *mysqlConn) CheckNamedValue(nv *driver.NamedValue) (err error) {
636
636
// ResetSession implements driver.SessionResetter.
637
637
// (From Go 1.10)
638
638
func (mc * mysqlConn ) ResetSession (ctx context.Context ) error {
639
- if mc .closed .IsSet () {
639
+ if mc .closed .Load () {
640
640
return driver .ErrBadConn
641
641
}
642
642
mc .reset = true
@@ -646,5 +646,5 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error {
646
646
// IsValid implements driver.Validator interface
647
647
// (From Go 1.15)
648
648
func (mc * mysqlConn ) IsValid () bool {
649
- return ! mc .closed .IsSet ()
649
+ return ! mc .closed .Load ()
650
650
}
0 commit comments