lock mu when checking if the pool is closed
@@ -291,7 +291,10 @@ func (c *SimplePool) HandleError(conn *Conn, err error, closed bool) {
return
}
c.removeConn(conn)
- if !c.quit {
+ c.mu.Lock()
+ poolClosed := c.quit
+ c.mu.Unlock()
+ if !poolClosed {
go c.fillPool() // top off pool.