aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2005-12-28 18:47:18 +0000
committerAnthony Green <green@gcc.gnu.org>2005-12-28 18:47:18 +0000
commitb21606a6c08054686b55066da4c49d12febfb60f (patch)
tree1ecab6e89338c5692fd215a2e1956390cf4d97dd
parent44fae9caaeb326cdb6b034b15fbb1c9412317275 (diff)
downloadgcc-b21606a6c08054686b55066da4c49d12febfb60f.zip
gcc-b21606a6c08054686b55066da4c49d12febfb60f.tar.gz
gcc-b21606a6c08054686b55066da4c49d12febfb60f.tar.bz2
natPlainSocketImplWin32.cc (connect): Same as previous patch, but for win32.
2005-12-28 Anthony Green <green@redhat.com> * gnu/java/net/natPlainSocketImplWin32.cc (connect): Same as previous patch, but for win32. From-SVN: r109119
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/gnu/java/net/natPlainSocketImplWin32.cc12
2 files changed, 14 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 7eea0f8..1606ccf 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,10 @@
2005-12-28 Anthony Green <green@redhat.com>
+ * gnu/java/net/natPlainSocketImplWin32.cc (connect): Same
+ as previous patch, but for win32.
+
+2005-12-28 Anthony Green <green@redhat.com>
+
* gnu/java/net/natPlainSocketImplPosix.cc (connect): Record
address and port before attempting anything.
diff --git a/libjava/gnu/java/net/natPlainSocketImplWin32.cc b/libjava/gnu/java/net/natPlainSocketImplWin32.cc
index 48c7171..f54edb5 100644
--- a/libjava/gnu/java/net/natPlainSocketImplWin32.cc
+++ b/libjava/gnu/java/net/natPlainSocketImplWin32.cc
@@ -133,6 +133,15 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
::java::net::InetAddress *host = tmp->getAddress();
jint rport = tmp->getPort();
+ // Set the SocketImpl's address and port fields before we try to
+ // connect. Note that the fact that these are set doesn't imply
+ // that we're actually connected to anything. We need to record
+ // this data before we attempt the connect, since non-blocking
+ // SocketChannels will use this and almost certainly throw timeout
+ // exceptions.
+ address = host;
+ port = rport;
+
union SockAddr u;
socklen_t addrlen = sizeof(u);
jbyteArray haddress = host->addr;
@@ -208,9 +217,6 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
throwConnectException();
}
- address = host;
- port = rport;
-
// A bind may not have been done on this socket; if so, set localport now.
if (localport == 0)
{