From 7ae26b74bcd4631279c50c88bb74d11723712e9c Mon Sep 17 00:00:00 2001 From: Nikolay Sivko Date: Fri, 4 Aug 2017 01:11:35 +0300 Subject: [PATCH] stop ConnPool.tryDial goroutine if pool was closed --- internal/pool/pool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/pool/pool.go b/internal/pool/pool.go index a4e6508..c769e01 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -119,6 +119,9 @@ func (p *ConnPool) NewConn() (*Conn, error) { func (p *ConnPool) tryDial() { for { + if p.closed() { + return + } conn, err := p.opt.Dialer() if err != nil { p.setLastDialError(err)