jdk/src/solaris/classes/sun/nio/ch/SctpChannelImpl.java

Print this page
rev 5686 : 7201071: InetSocketAddress serialization issue
Reviewed-by: alanb, michaelm, skoivu

*** 1017,1033 **** SocketAddress target, int streamNumber, boolean unordered, int ppid) throws IOException { int pos = bb.position(); int lim = bb.limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); ! int written = send0(fd, ((DirectBuffer)bb).address() + pos, ! rem, target, -1 /*121*/, streamNumber, unordered, ppid); if (written > 0) bb.position(pos + written); return written; } --- 1017,1041 ---- SocketAddress target, int streamNumber, boolean unordered, int ppid) throws IOException { + InetAddress addr = null; // no preferred address + int port = 0; + if (target != null) { + InetSocketAddress isa = Net.checkAddress(target); + addr = isa.getAddress(); + port = isa.getPort(); + } + int pos = bb.position(); int lim = bb.limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); ! int written = send0(fd, ((DirectBuffer)bb).address() + pos, rem, addr, ! port, -1 /*121*/, streamNumber, unordered, ppid); if (written > 0) bb.position(pos + written); return written; }
*** 1082,1092 **** static native int receive0(int fd, SctpResultContainer resultContainer, long address, int length, boolean peek) throws IOException; static native int send0(int fd, long address, int length, ! SocketAddress target, int assocId, int streamNumber, boolean unordered, int ppid) throws IOException; private static native int checkConnect(FileDescriptor fd, boolean block, boolean ready) throws IOException; --- 1090,1100 ---- static native int receive0(int fd, SctpResultContainer resultContainer, long address, int length, boolean peek) throws IOException; static native int send0(int fd, long address, int length, ! InetAddress addr, int port, int assocId, int streamNumber, boolean unordered, int ppid) throws IOException; private static native int checkConnect(FileDescriptor fd, boolean block, boolean ready) throws IOException;