aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2013-07-23 10:13:58 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2013-07-23 10:13:58 +0900
commit7d9a8fb8a913c21599959cd2cea3496ae0828bdc (patch)
tree27fe840876eb6f7c4570f1e726494edfdd8c4ee7 /src/pkg
parentf8fd77baa9e57b2de6b9c0e08a3de0a7a8ad8947 (diff)
downloadgo-7d9a8fb8a913c21599959cd2cea3496ae0828bdc.tar.xz
net: make use of noDeadline instead of time.Time{}
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/11691044
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/net/dnsclient_unix.go2
-rw-r--r--src/pkg/net/fd_posix_test.go4
-rw-r--r--src/pkg/net/sock_posix.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/net/dnsclient_unix.go b/src/pkg/net/dnsclient_unix.go
index 9e21bb4a0f..c9a16a94d8 100644
--- a/src/pkg/net/dnsclient_unix.go
+++ b/src/pkg/net/dnsclient_unix.go
@@ -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))
}
diff --git a/src/pkg/net/fd_posix_test.go b/src/pkg/net/fd_posix_test.go
index 8be0335d61..11a7eb1b80 100644
--- a/src/pkg/net/fd_posix_test.go
+++ b/src/pkg/net/fd_posix_test.go
@@ -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) {
diff --git a/src/pkg/net/sock_posix.go b/src/pkg/net/sock_posix.go
index be89c26db2..beaa5c8b01 100644
--- a/src/pkg/net/sock_posix.go
+++ b/src/pkg/net/sock_posix.go
@@ -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)
}
}