summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-28 18:29:10 +0000
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-28 18:29:10 +0000
commit06ca951d68a9144c793b1cef24b8f2bd4ed82947 (patch)
treedc4c778776ddd1e0534e7b2056e0444e8cc0ac08
parente175334c900392e2c65a5ce36dea8247f46f855f (diff)
downloadppe42-gcc-06ca951d68a9144c793b1cef24b8f2bd4ed82947.tar.gz
ppe42-gcc-06ca951d68a9144c793b1cef24b8f2bd4ed82947.zip
2005-12-28 Anthony Green <green@redhat.com>
* gnu/java/net/natPlainSocketImplPosix.cc (connect): Record address and port before attempting anything. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109116 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/gnu/java/net/natPlainSocketImplPosix.cc12
2 files changed, 14 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index cff2e26f6fa..7eea0f844a5 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-28 Anthony Green <green@redhat.com>
+
+ * gnu/java/net/natPlainSocketImplPosix.cc (connect): Record
+ address and port before attempting anything.
+
2005-12-28 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* sysdep/pa/locks.h (compare_and_swap): Add ldcw semaphore to make
diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
index 643f4e4909a..be9437cd7db 100644
--- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc
+++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
@@ -142,6 +142,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;
@@ -197,9 +206,6 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
goto error;
}
- address = host;
- port = rport;
-
// A bind may not have been done on this socket; if so, set localport now.
if (localport == 0)
{
OpenPOWER on IntegriCloud