Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (mc *mysqlConn) Close() (err error) {
}

mc.cleanup()

mc.clearResult()
return
}

Expand All @@ -153,13 +153,16 @@ func (mc *mysqlConn) cleanup() {

// Makes cleanup idempotent
close(mc.closech)
if mc.netConn == nil {
nc := mc.netConn
if nc == nil {
return
}
if err := mc.netConn.Close(); err != nil {
if err := nc.Close(); err != nil {
mc.log(err)
}
mc.clearResult()
// This function can be called from multiple goroutines.
// So we can not mc.clearResult() here.
// Caller should do it if they are in safe goroutine.
}

func (mc *mysqlConn) error() error {
Expand Down