Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
02faa939
Commit
02faa939
authored
Sep 10, 2013
by
Mikio Hara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: remove dreg of obsoleted network poller
R=golang-dev, dave CC=golang-dev
https://golang.org/cl/13396051
parent
6cbc5387
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
91 deletions
+0
-91
src/pkg/net/fd_posix_test.go
src/pkg/net/fd_posix_test.go
+0
-57
src/pkg/net/net.go
src/pkg/net/net.go
+0
-34
No files found.
src/pkg/net/fd_posix_test.go
deleted
100644 → 0
View file @
6cbc5387
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd windows
package
net
import
(
"testing"
"time"
)
var
deadlineSetTimeTests
=
[]
struct
{
input
time
.
Time
expected
int64
}{
{
noDeadline
,
0
},
{
time
.
Date
(
2009
,
11
,
10
,
23
,
00
,
00
,
00
,
time
.
UTC
),
1257894000000000000
},
// 2009-11-10 23:00:00 +0000 UTC
}
func
TestDeadlineSetTime
(
t
*
testing
.
T
)
{
for
_
,
tt
:=
range
deadlineSetTimeTests
{
var
d
deadline
d
.
setTime
(
tt
.
input
)
actual
:=
d
.
value
()
expected
:=
int64
(
0
)
if
!
tt
.
input
.
IsZero
()
{
expected
=
tt
.
input
.
UnixNano
()
}
if
actual
!=
expected
{
t
.
Errorf
(
"set/value failed: expected %v, actual %v"
,
expected
,
actual
)
}
}
}
var
deadlineExpiredTests
=
[]
struct
{
deadline
time
.
Time
expired
bool
}{
// note, times are relative to the start of the test run, not
// the start of TestDeadlineExpired
{
time
.
Now
()
.
Add
(
5
*
time
.
Minute
),
false
},
{
time
.
Now
()
.
Add
(
-
5
*
time
.
Minute
),
true
},
{
noDeadline
,
false
},
}
func
TestDeadlineExpired
(
t
*
testing
.
T
)
{
for
_
,
tt
:=
range
deadlineExpiredTests
{
var
d
deadline
d
.
set
(
tt
.
deadline
.
UnixNano
())
expired
:=
d
.
expired
()
if
expired
!=
tt
.
expired
{
t
.
Errorf
(
"expire failed: expected %v, actual %v"
,
tt
.
expired
,
expired
)
}
}
}
src/pkg/net/net.go
View file @
02faa939
...
@@ -46,7 +46,6 @@ import (
...
@@ -46,7 +46,6 @@ import (
"errors"
"errors"
"io"
"io"
"os"
"os"
"sync"
"syscall"
"syscall"
"time"
"time"
)
)
...
@@ -401,39 +400,6 @@ func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) {
...
@@ -401,39 +400,6 @@ func genericReadFrom(w io.Writer, r io.Reader) (n int64, err error) {
return
io
.
Copy
(
writerOnly
{
w
},
r
)
return
io
.
Copy
(
writerOnly
{
w
},
r
)
}
}
// deadline is an atomically-accessed number of nanoseconds since 1970
// or 0, if no deadline is set.
type
deadline
struct
{
sync
.
Mutex
val
int64
}
func
(
d
*
deadline
)
expired
()
bool
{
t
:=
d
.
value
()
return
t
>
0
&&
time
.
Now
()
.
UnixNano
()
>=
t
}
func
(
d
*
deadline
)
value
()
(
v
int64
)
{
d
.
Lock
()
v
=
d
.
val
d
.
Unlock
()
return
}
func
(
d
*
deadline
)
set
(
v
int64
)
{
d
.
Lock
()
d
.
val
=
v
d
.
Unlock
()
}
func
(
d
*
deadline
)
setTime
(
t
time
.
Time
)
{
if
t
.
IsZero
()
{
d
.
set
(
0
)
}
else
{
d
.
set
(
t
.
UnixNano
())
}
}
// Limit the number of concurrent cgo-using goroutines, because
// Limit the number of concurrent cgo-using goroutines, because
// each will block an entire operating system thread. The usual culprit
// each will block an entire operating system thread. The usual culprit
// is resolving many DNS names in separate goroutines but the DNS
// is resolving many DNS names in separate goroutines but the DNS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment