We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a64773 commit d86c452Copy full SHA for d86c452
connection.go
@@ -138,7 +138,7 @@ func (mc *mysqlConn) Close() (err error) {
138
}
139
140
mc.cleanup()
141
-
+ mc.clearResult()
142
return
143
144
@@ -153,13 +153,16 @@ func (mc *mysqlConn) cleanup() {
153
154
// Makes cleanup idempotent
155
close(mc.closech)
156
- if mc.netConn == nil {
+ nc := mc.netConn
157
+ if nc == nil {
158
159
- if err := mc.netConn.Close(); err != nil {
160
+ if err := nc.Close(); err != nil {
161
mc.log(err)
162
- mc.clearResult()
163
+ // This function can be called from multiple goroutines.
164
+ // So we can not mc.clearResult() here.
165
+ // Caller should do it if they are in safe goroutine.
166
167
168
func (mc *mysqlConn) error() error {
0 commit comments