From 0bfcbbf97f372abd36692ef7ddb0097bd42da77c Mon Sep 17 00:00:00 2001 From: green Date: Wed, 28 Dec 2005 18:47:18 +0000 Subject: 2005-12-28 Anthony Green * gnu/java/net/natPlainSocketImplWin32.cc (connect): Same as previous patch, but for win32. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109119 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 5 +++++ libjava/gnu/java/net/natPlainSocketImplWin32.cc | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'libjava') diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 7eea0f844a5..1606ccf9c42 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2005-12-28 Anthony Green + + * gnu/java/net/natPlainSocketImplWin32.cc (connect): Same + as previous patch, but for win32. + 2005-12-28 Anthony Green * gnu/java/net/natPlainSocketImplPosix.cc (connect): Record diff --git a/libjava/gnu/java/net/natPlainSocketImplWin32.cc b/libjava/gnu/java/net/natPlainSocketImplWin32.cc index 48c7171c7c1..f54edb54630 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) { -- cgit v1.2.1