summaryrefslogtreecommitdiff
path: root/libgo/go/net/ipsock_plan9.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-10-23 04:31:11 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-10-23 04:31:11 +0000
commit4ccad563d2a3559f0557bfb177bcf45144219bdf (patch)
tree46bb86f514fbf6bad82da48e69a18fb09d878834 /libgo/go/net/ipsock_plan9.go
parent0b7463235f0e23c624d1911c9b15f531108cc5a6 (diff)
downloadgcc-4ccad563d2a3559f0557bfb177bcf45144219bdf.tar.gz
libgo: Update to current sources.
From-SVN: r192704
Diffstat (limited to 'libgo/go/net/ipsock_plan9.go')
-rw-r--r--libgo/go/net/ipsock_plan9.go51
1 files changed, 48 insertions, 3 deletions
diff --git a/libgo/go/net/ipsock_plan9.go b/libgo/go/net/ipsock_plan9.go
index eab0bf3e899..7cc2d714d8a 100644
--- a/libgo/go/net/ipsock_plan9.go
+++ b/libgo/go/net/ipsock_plan9.go
@@ -14,9 +14,12 @@ import (
"time"
)
-// probeIPv6Stack returns two boolean values. If the first boolean value is
-// true, kernel supports basic IPv6 functionality. If the second
-// boolean value is true, kernel supports IPv6 IPv4-mapping.
+// /sys/include/ape/sys/socket.h:/SOMAXCONN
+var listenerBacklog = 5
+
+// probeIPv6Stack returns two boolean values. If the first boolean
+// value is true, kernel supports basic IPv6 functionality. If the
+// second boolean value is true, kernel supports IPv6 IPv4-mapping.
func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) {
return false, false
}
@@ -48,6 +51,7 @@ func readPlan9Addr(proto, filename string) (addr Addr, err error) {
if err != nil {
return
}
+ defer f.Close()
n, err := f.Read(buf[:])
if err != nil {
return
@@ -162,6 +166,25 @@ func (c *plan9Conn) SetWriteDeadline(t time.Time) error {
return syscall.EPLAN9
}
+// SetReadBuffer sets the size of the operating system's receive
+// buffer associated with the connection.
+func (c *plan9Conn) SetReadBuffer(bytes int) error {
+ return syscall.EPLAN9
+}
+
+// SetWriteBuffer sets the size of the operating system's transmit
+// buffer associated with the connection.
+func (c *plan9Conn) SetWriteBuffer(bytes int) error {
+ return syscall.EPLAN9
+}
+
+// File returns a copy of the underlying os.File, set to blocking
+// mode. It is the caller's responsibility to close f when finished.
+// Closing c does not affect f, and closing f does not affect c.
+func (c *plan9Conn) File() (f *os.File, err error) {
+ return nil, syscall.EPLAN9
+}
+
func startPlan9(net string, addr Addr) (ctl *os.File, dest, proto, name string, err error) {
var (
ip IP
@@ -192,6 +215,7 @@ func startPlan9(net string, addr Addr) (ctl *os.File, dest, proto, name string,
var buf [16]byte
n, err := f.Read(buf[:])
if err != nil {
+ f.Close()
return
}
return f, dest, proto, string(buf[:n]), nil
@@ -204,14 +228,17 @@ func dialPlan9(net string, laddr, raddr Addr) (c *plan9Conn, err error) {
}
_, err = f.WriteString("connect " + dest)
if err != nil {
+ f.Close()
return
}
laddr, err = readPlan9Addr(proto, "/net/"+proto+"/"+name+"/local")
if err != nil {
+ f.Close()
return
}
raddr, err = readPlan9Addr(proto, "/net/"+proto+"/"+name+"/remote")
if err != nil {
+ f.Close()
return
}
return newPlan9Conn(proto, name, f, laddr, raddr), nil
@@ -230,10 +257,12 @@ func listenPlan9(net string, laddr Addr) (l *plan9Listener, err error) {
}
_, err = f.WriteString("announce " + dest)
if err != nil {
+ f.Close()
return
}
laddr, err = readPlan9Addr(proto, "/net/"+proto+"/"+name+"/local")
if err != nil {
+ f.Close()
return
}
l = new(plan9Listener)
@@ -257,15 +286,18 @@ func (l *plan9Listener) acceptPlan9() (c *plan9Conn, err error) {
var buf [16]byte
n, err := f.Read(buf[:])
if err != nil {
+ f.Close()
return
}
name := string(buf[:n])
laddr, err := readPlan9Addr(l.proto, l.dir+"/local")
if err != nil {
+ f.Close()
return
}
raddr, err := readPlan9Addr(l.proto, l.dir+"/remote")
if err != nil {
+ f.Close()
return
}
return newPlan9Conn(l.proto, name, f, laddr, raddr), nil
@@ -287,3 +319,16 @@ func (l *plan9Listener) Close() error {
}
func (l *plan9Listener) Addr() Addr { return l.laddr }
+
+// SetDeadline sets the deadline associated with the listener.
+// A zero time value disables the deadline.
+func (l *plan9Listener) SetDeadline(t time.Time) error {
+ return syscall.EPLAN9
+}
+
+// File returns a copy of the underlying os.File, set to blocking
+// mode. It is the caller's responsibility to close f when finished.
+// Closing l does not affect f, and closing f does not affect l.
+func (l *plan9Listener) File() (f *os.File, err error) {
+ return nil, syscall.EPLAN9
+}