修复--timeout实际没生效的bug

This commit is contained in:
M09Ic 2023-06-30 17:29:49 +08:00
parent db29ce3e39
commit a36e06e96b
3 changed files with 5 additions and 6 deletions

View File

@ -23,7 +23,7 @@ func NewCheckPool(ctx context.Context, config *pkg.Config) (*CheckPool, error) {
Config: config, Config: config,
ctx: pctx, ctx: pctx,
cancel: cancel, cancel: cancel,
client: ihttp.NewClient(config.Thread, 2, config.ClientType), client: ihttp.NewClient(config.Thread, config.Timeout, config.ClientType),
wg: sync.WaitGroup{}, wg: sync.WaitGroup{},
additionCh: make(chan *Unit, 100), additionCh: make(chan *Unit, 100),
closeCh: make(chan struct{}), closeCh: make(chan struct{}),

View File

@ -47,7 +47,7 @@ func NewPool(ctx context.Context, config *pkg.Config) (*Pool, error) {
url: u, url: u,
ctx: pctx, ctx: pctx,
cancel: cancel, 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), baselines: make(map[int]*pkg.Baseline),
urls: make(map[string]struct{}), urls: make(map[string]struct{}),
scopeurls: make(map[string]struct{}), scopeurls: make(map[string]struct{}),

View File

@ -51,10 +51,9 @@ func NewClient(thread int, timeout int, clientType int) *Client {
Renegotiation: tls.RenegotiateOnceAsClient, Renegotiation: tls.RenegotiateOnceAsClient,
InsecureSkipVerify: true, InsecureSkipVerify: true,
}, },
TLSHandshakeTimeout: time.Duration(timeout) * time.Second, MaxConnsPerHost: thread * 3 / 2,
MaxConnsPerHost: thread * 3 / 2, IdleConnTimeout: time.Duration(timeout) * time.Second,
IdleConnTimeout: time.Duration(timeout) * time.Second, ReadBufferSize: 16384, // 16k
ReadBufferSize: 16384, // 16k
}, },
Timeout: time.Second * time.Duration(timeout), Timeout: time.Second * time.Duration(timeout),
CheckRedirect: func(req *http.Request, via []*http.Request) error { CheckRedirect: func(req *http.Request, via []*http.Request) error {