natPlainSocketImplPosix.cc (connect): Record address and port before attempting anything.
2005-12-28 Anthony Green <green@redhat.com> * gnu/java/net/natPlainSocketImplPosix.cc (connect): Record address and port before attempting anything. From-SVN: r109116
This commit is contained in:
parent
5c3bb9eb9e
commit
44fae9caae
2 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue