[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] jdk1.4.2, getsockname(), and ECONNRESET



In j2se/src/solaris/native/sun/nio/ch/Net.c, getsockname() is called to determine the local address and port of a socket.

Under both Linux and Solaris, getsockname() will only fail if invalid arguments are provided. If getsockname() returns an error, Java throws a java.lang.Error.
On FreeBSD, getsockname() will also return an error with errno set to ECONNRESET if the connection has been reset by the peer. Consequently, Java throws a java.lang.Error.


The only way to handle this without an API change is to check for ECONNRESET; In the attached patch, if errno is set to ECONNRESET we fill in the sockaddr structure with a port of 0, an IP of INADDR_ANY, and clear out the error.

Also, any comments on the thread-safe resolver patch?

Thanks,
-landonf

Attachment: getsockname-1.diff
Description: Binary data

Attachment: PGP.sig
Description: This is a digitally signed message part


Visit your host, monkey.org