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
58423360
Commit
58423360
authored
Oct 31, 2011
by
Fazlul Shahriar
Committed by
Russ Cox
Oct 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Plan 9 fixes
Makes all tests pass. R=rsc CC=golang-dev
https://golang.org/cl/5320041
parent
350a5ce6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
4 deletions
+42
-4
src/pkg/net/lookup_plan9.go
src/pkg/net/lookup_plan9.go
+11
-2
src/pkg/net/lookup_test.go
src/pkg/net/lookup_test.go
+2
-2
src/pkg/net/net_test.go
src/pkg/net/net_test.go
+4
-0
src/pkg/net/tcpsock_plan9.go
src/pkg/net/tcpsock_plan9.go
+18
-0
src/pkg/net/timeout_test.go
src/pkg/net/timeout_test.go
+7
-0
No files found.
src/pkg/net/lookup_plan9.go
View file @
58423360
...
@@ -49,7 +49,7 @@ func queryCS(net, host, service string) (res []string, err os.Error) {
...
@@ -49,7 +49,7 @@ func queryCS(net, host, service string) (res []string, err os.Error) {
func
queryCS1
(
net
string
,
ip
IP
,
port
int
)
(
clone
,
dest
string
,
err
os
.
Error
)
{
func
queryCS1
(
net
string
,
ip
IP
,
port
int
)
(
clone
,
dest
string
,
err
os
.
Error
)
{
ips
:=
"*"
ips
:=
"*"
if
!
ip
.
IsUnspecified
()
{
if
len
(
ip
)
!=
0
&&
!
ip
.
IsUnspecified
()
{
ips
=
ip
.
String
()
ips
=
ip
.
String
()
}
}
lines
,
err
:=
queryCS
(
net
,
ips
,
itoa
(
port
))
lines
,
err
:=
queryCS
(
net
,
ips
,
itoa
(
port
))
...
@@ -215,7 +215,16 @@ func LookupMX(name string) (mx []*MX, err os.Error) {
...
@@ -215,7 +215,16 @@ func LookupMX(name string) (mx []*MX, err os.Error) {
// LookupTXT returns the DNS TXT records for the given domain name.
// LookupTXT returns the DNS TXT records for the given domain name.
func
LookupTXT
(
name
string
)
(
txt
[]
string
,
err
os
.
Error
)
{
func
LookupTXT
(
name
string
)
(
txt
[]
string
,
err
os
.
Error
)
{
return
nil
,
os
.
NewError
(
"net.LookupTXT is not implemented on Plan 9"
)
lines
,
err
:=
queryDNS
(
name
,
"txt"
)
if
err
!=
nil
{
return
}
for
_
,
line
:=
range
lines
{
if
i
:=
byteIndex
(
line
,
'\t'
);
i
>=
0
{
txt
=
append
(
txt
,
line
[
i
+
1
:
])
}
}
return
}
}
// LookupAddr performs a reverse lookup for the given address, returning a list
// LookupAddr performs a reverse lookup for the given address, returning a list
...
...
src/pkg/net/lookup_test.go
View file @
58423360
...
@@ -52,8 +52,8 @@ func TestGmailMX(t *testing.T) {
...
@@ -52,8 +52,8 @@ func TestGmailMX(t *testing.T) {
}
}
func
TestGmailTXT
(
t
*
testing
.
T
)
{
func
TestGmailTXT
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"windows"
||
runtime
.
GOOS
==
"plan9"
{
if
runtime
.
GOOS
==
"windows"
{
t
.
Logf
(
"LookupTXT is not implemented on Windows
or Plan 9
"
)
t
.
Logf
(
"LookupTXT is not implemented on Windows"
)
return
return
}
}
if
testing
.
Short
()
||
avoidMacFirewall
{
if
testing
.
Short
()
||
avoidMacFirewall
{
...
...
src/pkg/net/net_test.go
View file @
58423360
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"flag"
"flag"
"os"
"os"
"regexp"
"regexp"
"runtime"
"testing"
"testing"
)
)
...
@@ -128,6 +129,9 @@ func TestReverseAddress(t *testing.T) {
...
@@ -128,6 +129,9 @@ func TestReverseAddress(t *testing.T) {
}
}
func
TestShutdown
(
t
*
testing
.
T
)
{
func
TestShutdown
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"plan9"
{
return
}
l
,
err
:=
Listen
(
"tcp"
,
"127.0.0.1:0"
)
l
,
err
:=
Listen
(
"tcp"
,
"127.0.0.1:0"
)
if
err
!=
nil
{
if
err
!=
nil
{
if
l
,
err
=
Listen
(
"tcp6"
,
"[::1]:0"
);
err
!=
nil
{
if
l
,
err
=
Listen
(
"tcp6"
,
"[::1]:0"
);
err
!=
nil
{
...
...
src/pkg/net/tcpsock_plan9.go
View file @
58423360
...
@@ -16,6 +16,24 @@ type TCPConn struct {
...
@@ -16,6 +16,24 @@ type TCPConn struct {
plan9Conn
plan9Conn
}
}
// CloseRead shuts down the reading side of the TCP connection.
// Most callers should just use Close.
func
(
c
*
TCPConn
)
CloseRead
()
os
.
Error
{
if
!
c
.
ok
()
{
return
os
.
EINVAL
}
return
os
.
EPLAN9
}
// CloseWrite shuts down the writing side of the TCP connection.
// Most callers should just use Close.
func
(
c
*
TCPConn
)
CloseWrite
()
os
.
Error
{
if
!
c
.
ok
()
{
return
os
.
EINVAL
}
return
os
.
EPLAN9
}
// DialTCP connects to the remote address raddr on the network net,
// DialTCP connects to the remote address raddr on the network net,
// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
// as the local address for the connection.
// as the local address for the connection.
...
...
src/pkg/net/timeout_test.go
View file @
58423360
...
@@ -6,6 +6,7 @@ package net
...
@@ -6,6 +6,7 @@ package net
import
(
import
(
"os"
"os"
"runtime"
"testing"
"testing"
"time"
"time"
)
)
...
@@ -41,11 +42,17 @@ func testTimeout(t *testing.T, network, addr string, readFrom bool) {
...
@@ -41,11 +42,17 @@ func testTimeout(t *testing.T, network, addr string, readFrom bool) {
}
}
func
TestTimeoutUDP
(
t
*
testing
.
T
)
{
func
TestTimeoutUDP
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"plan9"
{
return
}
testTimeout
(
t
,
"udp"
,
"127.0.0.1:53"
,
false
)
testTimeout
(
t
,
"udp"
,
"127.0.0.1:53"
,
false
)
testTimeout
(
t
,
"udp"
,
"127.0.0.1:53"
,
true
)
testTimeout
(
t
,
"udp"
,
"127.0.0.1:53"
,
true
)
}
}
func
TestTimeoutTCP
(
t
*
testing
.
T
)
{
func
TestTimeoutTCP
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"plan9"
{
return
}
// set up a listener that won't talk back
// set up a listener that won't talk back
listening
:=
make
(
chan
string
)
listening
:=
make
(
chan
string
)
done
:=
make
(
chan
int
)
done
:=
make
(
chan
int
)
...
...
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