Commit b21606a6 by Anthony Green Committed by Anthony Green

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
parent 44fae9ca
2005-12-28 Anthony Green <green@redhat.com> 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 * gnu/java/net/natPlainSocketImplPosix.cc (connect): Record
address and port before attempting anything. address and port before attempting anything.
......
...@@ -133,6 +133,15 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, ...@@ -133,6 +133,15 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
::java::net::InetAddress *host = tmp->getAddress(); ::java::net::InetAddress *host = tmp->getAddress();
jint rport = tmp->getPort(); 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; union SockAddr u;
socklen_t addrlen = sizeof(u); socklen_t addrlen = sizeof(u);
jbyteArray haddress = host->addr; jbyteArray haddress = host->addr;
...@@ -208,9 +217,6 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, ...@@ -208,9 +217,6 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr,
throwConnectException(); throwConnectException();
} }
address = host;
port = rport;
// A bind may not have been done on this socket; if so, set localport now. // A bind may not have been done on this socket; if so, set localport now.
if (localport == 0) if (localport == 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment