mirror of https://github.com/golang/go.git
net: make use of noDeadline instead of time.Time{}
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/11691044
This commit is contained in:
parent
f8fd77baa9
commit
7d9a8fb8a9
|
|
@ -46,7 +46,7 @@ func exchange(cfg *dnsConfig, c Conn, name string, qtype uint16) (*dnsMsg, error
|
|||
}
|
||||
|
||||
if cfg.timeout == 0 {
|
||||
c.SetReadDeadline(time.Time{})
|
||||
c.SetReadDeadline(noDeadline)
|
||||
} else {
|
||||
c.SetReadDeadline(time.Now().Add(time.Duration(cfg.timeout) * time.Second))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ var deadlineSetTimeTests = []struct {
|
|||
input time.Time
|
||||
expected int64
|
||||
}{
|
||||
{time.Time{}, 0},
|
||||
{noDeadline, 0},
|
||||
{time.Date(2009, 11, 10, 23, 00, 00, 00, time.UTC), 1257894000000000000}, // 2009-11-10 23:00:00 +0000 UTC
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ var deadlineExpiredTests = []struct {
|
|||
// the start of TestDeadlineExpired
|
||||
{time.Now().Add(5 * time.Minute), false},
|
||||
{time.Now().Add(-5 * time.Minute), true},
|
||||
{time.Time{}, false}, // no deadline set
|
||||
{noDeadline, false},
|
||||
}
|
||||
|
||||
func TestDeadlineExpired(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func socket(net string, f, t, p int, ipv6only bool, ulsa, ursa syscall.Sockaddr,
|
|||
}
|
||||
fd.isConnected = true
|
||||
if !deadline.IsZero() {
|
||||
setWriteDeadline(fd, time.Time{})
|
||||
setWriteDeadline(fd, noDeadline)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue