Commit 7d9a8fb8 authored by Mikio Hara's avatar Mikio Hara

net: make use of noDeadline instead of time.Time{}

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11691044
parent f8fd77ba
......@@ -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)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment