From 49147a3f7e75bd3780bb8e51de3fa78a10036105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E6=A0=91=E7=AB=8B?= <1923244321@qq.com> Date: Wed, 18 Mar 2020 22:59:16 +0800 Subject: [PATCH] Update pool.go --- pool/pool.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pool/pool.go b/pool/pool.go index 57a9f39..1924a49 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -96,12 +96,15 @@ func NewCustom(network, addr string, size int, df DialFunc, os ...Opt) (*Pool, e doEvery(po.pingInterval, func() { // instead of using Cmd/Get, which might make a new connection, // we only check from the pool - select { - case conn := <-p.pool: - // we don't care if PING errors since Put will handle that - conn.Cmd("PING") - p.Put(conn) - default: + //ping for every socket + for i:=0;i