Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Stiemerling
Go
Commits
7d9a8fb8
Commit
7d9a8fb8
authored
11 years ago
by
Mikio Hara
Browse files
Options
Downloads
Patches
Plain Diff
net: make use of noDeadline instead of time.Time{}
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/11691044
parent
f8fd77ba
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/pkg/net/dnsclient_unix.go
+1
-1
1 addition, 1 deletion
src/pkg/net/dnsclient_unix.go
src/pkg/net/fd_posix_test.go
+2
-2
2 additions, 2 deletions
src/pkg/net/fd_posix_test.go
src/pkg/net/sock_posix.go
+1
-1
1 addition, 1 deletion
src/pkg/net/sock_posix.go
with
4 additions
and
4 deletions
src/pkg/net/dnsclient_unix.go
+
1
−
1
View file @
7d9a8fb8
...
...
@@ -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
))
}
...
...
This diff is collapsed.
Click to expand it.
src/pkg/net/fd_posix_test.go
+
2
−
2
View file @
7d9a8fb8
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/pkg/net/sock_posix.go
+
1
−
1
View file @
7d9a8fb8
...
...
@@ -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
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment