File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ func (mc *mysqlConn) Close() (err error) {
132
132
}
133
133
134
134
mc .cleanup ()
135
-
135
+ mc . clearResult ()
136
136
return
137
137
}
138
138
@@ -147,13 +147,16 @@ func (mc *mysqlConn) cleanup() {
147
147
148
148
// Makes cleanup idempotent
149
149
close (mc .closech )
150
- if mc .netConn == nil {
150
+ nc := mc .netConn
151
+ if nc == nil {
151
152
return
152
153
}
153
- if err := mc . netConn .Close (); err != nil {
154
- mc .cfg . Logger . Print (err )
154
+ if err := nc .Close (); err != nil {
155
+ mc .log (err )
155
156
}
156
- mc .clearResult ()
157
+ // This function can be called from multiple goroutines.
158
+ // So we can not mc.clearResult() here.
159
+ // Caller should do it if they are in safe goroutine.
157
160
}
158
161
159
162
func (mc * mysqlConn ) error () error {
You can’t perform that action at this time.
0 commit comments