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) {
132132 }
133133
134134 mc .cleanup ()
135-
135+ mc . clearResult ()
136136 return
137137}
138138
@@ -147,13 +147,16 @@ func (mc *mysqlConn) cleanup() {
147147
148148 // Makes cleanup idempotent
149149 close (mc .closech )
150- if mc .netConn == nil {
150+ nc := mc .netConn
151+ if nc == nil {
151152 return
152153 }
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 )
155156 }
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.
157160}
158161
159162func (mc * mysqlConn ) error () error {
You can’t perform that action at this time.
0 commit comments