aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/sql.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/sql/sql.go')
-rw-r--r--src/database/sql/sql.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index de774a0510..c247a9b506 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -1368,8 +1368,8 @@ func (db *DB) conn(ctx context.Context, strategy connReuseStrategy) (*driverConn
db.waitDuration.Add(int64(time.Since(waitStart)))
- // If we failed to delete it, that means something else
- // grabbed it and is about to send on it.
+ // If we failed to delete it, that means either the DB was closed or
+ // something else grabbed it and is about to send on it.
if !deleted {
// TODO(bradfitz): rather than this best effort select, we
// should probably start a goroutine to read from req. This best
@@ -3594,6 +3594,7 @@ type connRequestAndIndex struct {
// and clears the set.
func (s *connRequestSet) CloseAndRemoveAll() {
for _, v := range s.s {
+ *v.curIdx = -1
close(v.req)
}
s.s = nil