Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readTimeout/connectTimeout的单位不统一 #74

Open
yousong opened this issue Dec 7, 2022 · 0 comments
Open

readTimeout/connectTimeout的单位不统一 #74

yousong opened this issue Dec 7, 2022 · 0 comments

Comments

@yousong
Copy link

yousong commented Dec 7, 2022

目前的代码看起来是millisecond, second混着的

readTimeout是millisecond

tea/tea/tea.go

Lines 350 to 358 in b9ace42

if !client.ifInit {
trans, err := getHttpTransport(request, runtimeObject)
if err != nil {
return nil, err
}
client.httpClient.Timeout = time.Duration(IntValue(runtimeObject.ReadTimeout)) * time.Millisecond
client.httpClient.Transport = trans
client.ifInit = true
}

connectTimeout既有millisecond (socks5),也有second (direct)

tea/tea/tea.go

Lines 462 to 467 in b9ace42

dialer, err := proxy.SOCKS5(strings.ToLower(StringValue(runtime.Socks5NetWork)), socks5Proxy.String(), auth,
&net.Dialer{
Timeout: time.Duration(IntValue(runtime.ConnectTimeout)) * time.Millisecond,
DualStack: true,
LocalAddr: getLocalAddr(StringValue(runtime.LocalAddr)),
})

tea/tea/tea.go

Lines 577 to 586 in b9ace42

return (&net.Dialer{
Timeout: time.Duration(IntValue(runtime.ConnectTimeout)) * time.Second,
DualStack: true,
LocalAddr: netAddr,
}).DialContext(ctx, network, address)
}
return (&net.Dialer{
Timeout: time.Duration(IntValue(runtime.ConnectTimeout)) * time.Second,
DualStack: true,
}).DialContext(ctx, network, address)

@yousong yousong changed the title readTimeout/connectTimeout的单位到底是millisecond还是second readTimeout/connectTimeout的单位不统一 Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant