From a36e06e96b9df38680193807e22c7088fd2d2403 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Fri, 30 Jun 2023 17:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D--timeout=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E6=B2=A1=E7=94=9F=E6=95=88=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/checkpool.go | 2 +- internal/pool.go | 2 +- pkg/ihttp/client.go | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/checkpool.go b/internal/checkpool.go index c7e8ff7..9042951 100644 --- a/internal/checkpool.go +++ b/internal/checkpool.go @@ -23,7 +23,7 @@ func NewCheckPool(ctx context.Context, config *pkg.Config) (*CheckPool, error) { Config: config, ctx: pctx, cancel: cancel, - client: ihttp.NewClient(config.Thread, 2, config.ClientType), + client: ihttp.NewClient(config.Thread, config.Timeout, config.ClientType), wg: sync.WaitGroup{}, additionCh: make(chan *Unit, 100), closeCh: make(chan struct{}), diff --git a/internal/pool.go b/internal/pool.go index 0d60a4a..8865c05 100644 --- a/internal/pool.go +++ b/internal/pool.go @@ -47,7 +47,7 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) { url: u, ctx: pctx, cancel: cancel, - client: ihttp.NewClient(config.Thread, 2, config.ClientType), + client: ihttp.NewClient(config.Thread, config.Timeout, config.ClientType), baselines: make(map[int]*pkg.Baseline), urls: make(map[string]struct{}), scopeurls: make(map[string]struct{}), diff --git a/pkg/ihttp/client.go b/pkg/ihttp/client.go index 39d093b..05b3cae 100644 --- a/pkg/ihttp/client.go +++ b/pkg/ihttp/client.go @@ -51,10 +51,9 @@ func NewClient(thread int, timeout int, clientType int) *Client { Renegotiation: tls.RenegotiateOnceAsClient, InsecureSkipVerify: true, }, - TLSHandshakeTimeout: time.Duration(timeout) * time.Second, - MaxConnsPerHost: thread * 3 / 2, - IdleConnTimeout: time.Duration(timeout) * time.Second, - ReadBufferSize: 16384, // 16k + MaxConnsPerHost: thread * 3 / 2, + IdleConnTimeout: time.Duration(timeout) * time.Second, + ReadBufferSize: 16384, // 16k }, Timeout: time.Second * time.Duration(timeout), CheckRedirect: func(req *http.Request, via []*http.Request) error {