You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Dialer struct {
// Timeout is the maximum amount of time a dial will wait for
// a connect to complete. If Deadline is also set, it may fail
// earlier.
//
// The default is no timeout.
//
// When using TCP and dialing a host name with multiple IP
// addresses, the timeout may be divided between them.
//
// With or without a timeout, the operating system may impose
// its own earlier timeout. For instance, TCP timeouts are
// often around 3 minutes.
Timeout [time](https://pkg.go.dev/time).[Duration](https://pkg.go.dev/time#Duration)
......
Hi @likexian,
我遇到了和 #37 相同的问题,经过测试和检查 whois.go 的源代码,我猜测:
SetTimeout()
只设置了c.timeout
,而c.dialer.Timeout
没有被更新,它在NewClient()
时已经被固定为 30 秒;c.dialer.Dial()
则 timeout 无效;之所以会得出这个猜测,是因为今晚我所在的网络无法连接到
whois.nic.work
这个服务器,以下为 ping 表现:然后看了一下 net 包中关于 Dialer.Timeout 的解释,好像确实与连接时的超时有关:
EDIT: 补充一个复现方法:
如此,即可复现 5 秒超时的设置并没起作用,连接
www.google.com:43
要等到 30 秒后才超时。由于这是第一次接触 go 语言,如果猜测错误,请见谅
感谢
The text was updated successfully, but these errors were encountered: