aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/websocket
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-12-12 23:40:51 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-12-12 23:40:51 +0000
commitab61e9c4da707f3bc7b177c0c8f92daccdb142dc (patch)
tree0c68629fac9d7c6f103b401c9063ef00ed259f06 /libgo/go/websocket
parent6e456f4cf4deee3e2ccd9849286f59b90644c48b (diff)
downloadgcc-ab61e9c4da707f3bc7b177c0c8f92daccdb142dc.zip
gcc-ab61e9c4da707f3bc7b177c0c8f92daccdb142dc.tar.gz
gcc-ab61e9c4da707f3bc7b177c0c8f92daccdb142dc.tar.bz2
libgo: Update to weekly.2011-11-18.
From-SVN: r182266
Diffstat (limited to 'libgo/go/websocket')
-rw-r--r--libgo/go/websocket/websocket.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/libgo/go/websocket/websocket.go b/libgo/go/websocket/websocket.go
index 1e4036c..df4416e 100644
--- a/libgo/go/websocket/websocket.go
+++ b/libgo/go/websocket/websocket.go
@@ -10,12 +10,12 @@ import (
"bufio"
"crypto/tls"
"encoding/json"
+ "errors"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
- "os"
"sync"
)
@@ -243,12 +243,14 @@ func (ws *Conn) RemoteAddr() net.Addr {
return &Addr{ws.config.Origin}
}
+var errSetTimeout = errors.New("websocket: cannot set timeout: not using a net.Conn")
+
// SetTimeout sets the connection's network timeout in nanoseconds.
func (ws *Conn) SetTimeout(nsec int64) error {
if conn, ok := ws.rwc.(net.Conn); ok {
return conn.SetTimeout(nsec)
}
- return os.EINVAL
+ return errSetTimeout
}
// SetReadTimeout sets the connection's network read timeout in nanoseconds.
@@ -256,7 +258,7 @@ func (ws *Conn) SetReadTimeout(nsec int64) error {
if conn, ok := ws.rwc.(net.Conn); ok {
return conn.SetReadTimeout(nsec)
}
- return os.EINVAL
+ return errSetTimeout
}
// SetWriteTimeout sets the connection's network write timeout in nanoseconds.
@@ -264,7 +266,7 @@ func (ws *Conn) SetWriteTimeout(nsec int64) error {
if conn, ok := ws.rwc.(net.Conn); ok {
return conn.SetWriteTimeout(nsec)
}
- return os.EINVAL
+ return errSetTimeout
}
// Config returns the WebSocket config.