summaryrefslogtreecommitdiff
path: root/libgo/go/net
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-28 18:00:30 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-28 18:00:30 +0000
commitba972841a929bf2f24a3a5a72fe9f071e84ca1ee (patch)
treeedcb545da1741175776adf7bc27e61b808637602 /libgo/go/net
parentdf05db280231e2cd01f43b76a17b2e6d03e82edc (diff)
downloadgcc-ba972841a929bf2f24a3a5a72fe9f071e84ca1ee.tar.gz
net: work around Solaris connect issue when server closes socket
On Solaris, if you do a in-progress connect, and then the server accepts and closes the socket, the client's later attempt to complete the connect will fail with EINVAL. Handle this case by assuming that the connect succeeded. This code is weird enough that it is implemented as Solaris-only so that it doesn't hide a real error on a different OS. See http://golang.org/issue/6828. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206232 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net')
-rw-r--r--libgo/go/net/fd_unix.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libgo/go/net/fd_unix.go b/libgo/go/net/fd_unix.go
index 4911ab0abe3..a89303e37e9 100644
--- a/libgo/go/net/fd_unix.go
+++ b/libgo/go/net/fd_unix.go
@@ -80,6 +80,16 @@ func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
if err == nil || err == syscall.EISCONN {
break
}
+
+ // On Solaris we can see EINVAL if the socket has
+ // already been accepted and closed by the server.
+ // Treat this as a successful connection--writes to
+ // the socket will see EOF. For details and a test
+ // case in C see http://golang.org/issue/6828.
+ if runtime.GOOS == "solaris" && err == syscall.EINVAL {
+ break
+ }
+
if err != syscall.EINPROGRESS && err != syscall.EALREADY && err != syscall.EINTR {
return err
}