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