8233847: (sctp) Flx link-local IPv6 scope handling and test cleanup
Reviewed-by: alanb
This commit is contained in:
parent
180ffe5e45
commit
76e5a32c52
@ -240,8 +240,9 @@ module java.base {
|
|||||||
jdk.naming.dns;
|
jdk.naming.dns;
|
||||||
exports sun.net.util to
|
exports sun.net.util to
|
||||||
java.desktop,
|
java.desktop,
|
||||||
|
java.net.http,
|
||||||
jdk.jconsole,
|
jdk.jconsole,
|
||||||
java.net.http;
|
jdk.sctp;
|
||||||
exports sun.net.www to
|
exports sun.net.www to
|
||||||
java.net.http,
|
java.net.http,
|
||||||
jdk.jartool;
|
jdk.jartool;
|
||||||
|
@ -29,7 +29,7 @@ package com.sun.nio.sctp;
|
|||||||
*
|
*
|
||||||
* <P> The {@code HandlerResult} is used to determine the behavior of the
|
* <P> The {@code HandlerResult} is used to determine the behavior of the
|
||||||
* channel after it handles a notification from the SCTP stack. Essentially its
|
* channel after it handles a notification from the SCTP stack. Essentially its
|
||||||
* value determines if the channel should try to receive another notificaiton or
|
* value determines if the channel should try to receive another notification or
|
||||||
* a message before returning.
|
* a message before returning.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
@ -53,6 +53,7 @@ import com.sun.nio.sctp.MessageInfo;
|
|||||||
import com.sun.nio.sctp.NotificationHandler;
|
import com.sun.nio.sctp.NotificationHandler;
|
||||||
import com.sun.nio.sctp.SctpChannel;
|
import com.sun.nio.sctp.SctpChannel;
|
||||||
import com.sun.nio.sctp.SctpSocketOption;
|
import com.sun.nio.sctp.SctpSocketOption;
|
||||||
|
import sun.net.util.IPAddressUtil;
|
||||||
import sun.nio.ch.DirectBuffer;
|
import sun.nio.ch.DirectBuffer;
|
||||||
import sun.nio.ch.IOStatus;
|
import sun.nio.ch.IOStatus;
|
||||||
import sun.nio.ch.IOUtil;
|
import sun.nio.ch.IOUtil;
|
||||||
@ -1012,6 +1013,9 @@ public class SctpChannelImpl extends SctpChannel
|
|||||||
if (target != null) {
|
if (target != null) {
|
||||||
InetSocketAddress isa = Net.checkAddress(target);
|
InetSocketAddress isa = Net.checkAddress(target);
|
||||||
addr = isa.getAddress();
|
addr = isa.getAddress();
|
||||||
|
if (addr.isLinkLocalAddress()) {
|
||||||
|
addr = IPAddressUtil.toScopedAddress(addr);
|
||||||
|
}
|
||||||
port = isa.getPort();
|
port = isa.getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ import com.sun.nio.sctp.MessageInfo;
|
|||||||
import com.sun.nio.sctp.SctpChannel;
|
import com.sun.nio.sctp.SctpChannel;
|
||||||
import com.sun.nio.sctp.SctpMultiChannel;
|
import com.sun.nio.sctp.SctpMultiChannel;
|
||||||
import com.sun.nio.sctp.SctpSocketOption;
|
import com.sun.nio.sctp.SctpSocketOption;
|
||||||
|
import sun.net.util.IPAddressUtil;
|
||||||
import sun.nio.ch.DirectBuffer;
|
import sun.nio.ch.DirectBuffer;
|
||||||
import sun.nio.ch.NativeThread;
|
import sun.nio.ch.NativeThread;
|
||||||
import sun.nio.ch.IOStatus;
|
import sun.nio.ch.IOStatus;
|
||||||
@ -892,6 +893,9 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
|||||||
if (target != null) {
|
if (target != null) {
|
||||||
InetSocketAddress isa = Net.checkAddress(target);
|
InetSocketAddress isa = Net.checkAddress(target);
|
||||||
addr = isa.getAddress();
|
addr = isa.getAddress();
|
||||||
|
if (addr.isLinkLocalAddress()) {
|
||||||
|
addr = IPAddressUtil.toScopedAddress(addr);
|
||||||
|
}
|
||||||
port = isa.getPort();
|
port = isa.getPort();
|
||||||
}
|
}
|
||||||
int pos = bb.position();
|
int pos = bb.position();
|
||||||
|
@ -34,6 +34,7 @@ import java.util.Set;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
|
import sun.net.util.IPAddressUtil;
|
||||||
import sun.nio.ch.IOUtil;
|
import sun.nio.ch.IOUtil;
|
||||||
import sun.nio.ch.Net;
|
import sun.nio.ch.Net;
|
||||||
import com.sun.nio.sctp.SctpSocketOption;
|
import com.sun.nio.sctp.SctpSocketOption;
|
||||||
@ -169,9 +170,13 @@ public class SctpNet {
|
|||||||
InetSocketAddress netAddr = (InetSocketAddress)addr;
|
InetSocketAddress netAddr = (InetSocketAddress)addr;
|
||||||
|
|
||||||
if (name.equals(SCTP_PRIMARY_ADDR)) {
|
if (name.equals(SCTP_PRIMARY_ADDR)) {
|
||||||
|
InetAddress inetAddress = netAddr.getAddress();
|
||||||
|
if (inetAddress.isLinkLocalAddress()) {
|
||||||
|
inetAddress = IPAddressUtil.toScopedAddress(inetAddress);
|
||||||
|
}
|
||||||
setPrimAddrOption0(fd,
|
setPrimAddrOption0(fd,
|
||||||
assocId,
|
assocId,
|
||||||
netAddr.getAddress(),
|
inetAddress,
|
||||||
netAddr.getPort());
|
netAddr.getPort());
|
||||||
} else {
|
} else {
|
||||||
setPeerPrimAddrOption0(fd,
|
setPeerPrimAddrOption0(fd,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -110,9 +110,10 @@ public class Bind {
|
|||||||
try {
|
try {
|
||||||
channel.close(); /* open a new unbound channel for test */
|
channel.close(); /* open a new unbound channel for test */
|
||||||
channel = SctpChannel.open();
|
channel = SctpChannel.open();
|
||||||
connectChannel(channel);
|
try (var peer = connectChannel(channel)) {
|
||||||
channel.bind(null);
|
channel.bind(null);
|
||||||
fail("AlreadyConnectedException expected");
|
fail("AlreadyConnectedException expected");
|
||||||
|
}
|
||||||
} catch (AlreadyConnectedException unused) { pass();
|
} catch (AlreadyConnectedException unused) { pass();
|
||||||
} catch (IOException ioe) { unexpected(ioe); }
|
} catch (IOException ioe) { unexpected(ioe); }
|
||||||
|
|
||||||
@ -264,6 +265,8 @@ public class Bind {
|
|||||||
} finally {
|
} finally {
|
||||||
try { if (channel != null) channel.close(); }
|
try { if (channel != null) channel.close(); }
|
||||||
catch (IOException ioe) { unexpected(ioe); }
|
catch (IOException ioe) { unexpected(ioe); }
|
||||||
|
try { if (peerChannel != null) peerChannel.close(); }
|
||||||
|
catch (IOException ioe) { unexpected(ioe); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -191,6 +191,9 @@ public class CommUp {
|
|||||||
}
|
}
|
||||||
} //for
|
} //for
|
||||||
|
|
||||||
|
try { sc.close(); }
|
||||||
|
catch (IOException ioe) { unexpected(ioe); }
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
unexpected(ioe);
|
unexpected(ioe);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
@ -61,11 +61,10 @@ public class Connect {
|
|||||||
|
|
||||||
void doTest() {
|
void doTest() {
|
||||||
SctpChannel channel = null;
|
SctpChannel channel = null;
|
||||||
SctpServerChannel ssc = null;
|
|
||||||
|
|
||||||
try {
|
try (SctpServerChannel ssc = SctpServerChannel.open()) {
|
||||||
/* Create a server channel to connect to */
|
/* Create a server channel to connect to */
|
||||||
ssc = SctpServerChannel.open().bind(null);
|
ssc.bind(null);
|
||||||
Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
|
Set<SocketAddress> addrs = ssc.getAllLocalAddresses();
|
||||||
if (addrs.isEmpty())
|
if (addrs.isEmpty())
|
||||||
debug("addrs should not be empty");
|
debug("addrs should not be empty");
|
||||||
@ -209,8 +208,6 @@ public class Connect {
|
|||||||
} finally {
|
} finally {
|
||||||
try { if (channel != null) channel.close(); }
|
try { if (channel != null) channel.close(); }
|
||||||
catch (IOException unused) {}
|
catch (IOException unused) {}
|
||||||
try { if (ssc != null) ssc.close(); }
|
|
||||||
catch (IOException unused) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,7 @@ public class SocketOptionTests {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try (SctpChannel sc = SctpChannel.open()) {
|
||||||
SctpChannel sc = SctpChannel.open();
|
|
||||||
|
|
||||||
/* check supported options */
|
/* check supported options */
|
||||||
Set<SctpSocketOption<?>> options = sc.supportedOptions();
|
Set<SctpSocketOption<?>> options = sc.supportedOptions();
|
||||||
@ -143,8 +142,6 @@ public class SocketOptionTests {
|
|||||||
|
|
||||||
/* SCTP_PRIMARY_ADDR */
|
/* SCTP_PRIMARY_ADDR */
|
||||||
void sctpPrimaryAddr() throws IOException {
|
void sctpPrimaryAddr() throws IOException {
|
||||||
SocketAddress addrToSet = null;;
|
|
||||||
|
|
||||||
System.out.println("TESTING SCTP_PRIMARY_ADDR");
|
System.out.println("TESTING SCTP_PRIMARY_ADDR");
|
||||||
SctpChannel sc = SctpChannel.open();
|
SctpChannel sc = SctpChannel.open();
|
||||||
SctpServerChannel ssc = SctpServerChannel.open().bind(null);
|
SctpServerChannel ssc = SctpServerChannel.open().bind(null);
|
||||||
@ -158,12 +155,11 @@ public class SocketOptionTests {
|
|||||||
sc.connect(serverAddr);
|
sc.connect(serverAddr);
|
||||||
SctpChannel peerChannel = ssc.accept();
|
SctpChannel peerChannel = ssc.accept();
|
||||||
ssc.close();
|
ssc.close();
|
||||||
Set<SocketAddress> peerAddrs = peerChannel.getAllLocalAddresses();
|
Set<SocketAddress> remoteAddresses = sc.getRemoteAddresses();
|
||||||
debug("Peer local Addresses: ");
|
debug("Remote Addresses: ");
|
||||||
for (Iterator<SocketAddress> it = peerAddrs.iterator(); it.hasNext(); ) {
|
for (Iterator<SocketAddress> it = remoteAddresses.iterator(); it.hasNext(); ) {
|
||||||
InetSocketAddress addr = (InetSocketAddress)it.next();
|
InetSocketAddress addr = (InetSocketAddress)it.next();
|
||||||
debug("\t" + addr);
|
debug("\t" + addr);
|
||||||
addrToSet = addr; // any of the peer addresses will do!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */
|
/* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */
|
||||||
@ -176,18 +172,11 @@ public class SocketOptionTests {
|
|||||||
} else { /* Linux */
|
} else { /* Linux */
|
||||||
SocketAddress primaryAddr = sc.getOption(SCTP_PRIMARY_ADDR);
|
SocketAddress primaryAddr = sc.getOption(SCTP_PRIMARY_ADDR);
|
||||||
System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr);
|
System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr);
|
||||||
/* Verify that this is one of the peer addresses */
|
/* Verify that this is one of the remote addresses */
|
||||||
boolean found = false;
|
check(remoteAddresses.contains(primaryAddr), "SCTP_PRIMARY_ADDR returned bogus address!");
|
||||||
addrToSet = primaryAddr; // may not have more than one addr
|
|
||||||
for (Iterator<SocketAddress> it = peerAddrs.iterator(); it.hasNext(); ) {
|
|
||||||
InetSocketAddress addr = (InetSocketAddress)it.next();
|
|
||||||
if (addr.equals(primaryAddr)) {
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
addrToSet = addr;
|
|
||||||
}
|
|
||||||
check(found, "SCTP_PRIMARY_ADDR returned bogus address!");
|
|
||||||
|
|
||||||
|
for (Iterator<SocketAddress> it = remoteAddresses.iterator(); it.hasNext(); ) {
|
||||||
|
InetSocketAddress addrToSet = (InetSocketAddress) it.next();
|
||||||
System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet);
|
System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet);
|
||||||
sc.setOption(SCTP_PRIMARY_ADDR, addrToSet);
|
sc.setOption(SCTP_PRIMARY_ADDR, addrToSet);
|
||||||
System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet);
|
System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet);
|
||||||
@ -195,6 +184,9 @@ public class SocketOptionTests {
|
|||||||
System.out.println("SCTP_PRIMARY_ADDR returned : " + primaryAddr);
|
System.out.println("SCTP_PRIMARY_ADDR returned : " + primaryAddr);
|
||||||
check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly");
|
check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
sc.close();
|
||||||
|
peerChannel.close();
|
||||||
}
|
}
|
||||||
//--------------------- Infrastructure ---------------------------
|
//--------------------- Infrastructure ---------------------------
|
||||||
boolean debug = true;
|
boolean debug = true;
|
||||||
|
@ -210,7 +210,8 @@ public class Branch {
|
|||||||
/* echo the message */
|
/* echo the message */
|
||||||
debug("Server: echoing first message");
|
debug("Server: echoing first message");
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
int bytes = serverChannel.send(buffer, info);
|
MessageInfo sendInfo = MessageInfo.createOutgoing(info.association(), null, 0);
|
||||||
|
int bytes = serverChannel.send(buffer, sendInfo);
|
||||||
debug("Server: sent " + bytes + "bytes");
|
debug("Server: sent " + bytes + "bytes");
|
||||||
|
|
||||||
clientFinishedLatch.await(10L, TimeUnit.SECONDS);
|
clientFinishedLatch.await(10L, TimeUnit.SECONDS);
|
||||||
|
@ -276,7 +276,8 @@ public class Send {
|
|||||||
/* echo the message */
|
/* echo the message */
|
||||||
debug("Server: echoing first message");
|
debug("Server: echoing first message");
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
int bytes = serverChannel.send(buffer, info);
|
MessageInfo sendInfo = MessageInfo.createOutgoing(assoc, null, info.streamNumber());
|
||||||
|
int bytes = serverChannel.send(buffer, sendInfo);
|
||||||
debug("Server: sent " + bytes + "bytes");
|
debug("Server: sent " + bytes + "bytes");
|
||||||
|
|
||||||
/* receive a large message */
|
/* receive a large message */
|
||||||
@ -302,7 +303,8 @@ public class Send {
|
|||||||
/* echo the message */
|
/* echo the message */
|
||||||
debug("Server: echoing second message");
|
debug("Server: echoing second message");
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
bytes = serverChannel.send(buffer, info);
|
sendInfo = MessageInfo.createOutgoing(assoc, null, info.streamNumber());
|
||||||
|
bytes = serverChannel.send(buffer, sendInfo);
|
||||||
debug("Server: sent " + bytes + "bytes");
|
debug("Server: sent " + bytes + "bytes");
|
||||||
|
|
||||||
/* TEST 6 */
|
/* TEST 6 */
|
||||||
|
@ -98,14 +98,19 @@ public class SendFailed {
|
|||||||
new SendFailedNotificationHandler();
|
new SendFailedNotificationHandler();
|
||||||
ByteBuffer recvBuffer = direct ? allocateDirect(recvBufferSize)
|
ByteBuffer recvBuffer = direct ? allocateDirect(recvBufferSize)
|
||||||
: allocate((recvBufferSize));
|
: allocate((recvBufferSize));
|
||||||
channel.receive(recvBuffer, null, handler);
|
MessageInfo info = channel.receive(recvBuffer, null, handler);
|
||||||
|
debug("receive returned info:" + info);
|
||||||
|
|
||||||
|
if (handler.receivedSendFailed) {
|
||||||
// verify sent buffer received by send failed notification
|
// verify sent buffer received by send failed notification
|
||||||
ByteBuffer buffer = handler.getSendFailedByteBuffer();
|
ByteBuffer buffer = handler.getSendFailedByteBuffer();
|
||||||
check(buffer.remaining() == sent);
|
check(buffer.remaining() == sent);
|
||||||
check(buffer.position() == 0);
|
check(buffer.position() == 0);
|
||||||
check(buffer.limit() == sent);
|
check(buffer.limit() == sent);
|
||||||
assertSameContent(sendBuffer, handler.getSendFailedByteBuffer());
|
assertSameContent(sendBuffer, handler.getSendFailedByteBuffer());
|
||||||
|
} else {
|
||||||
|
debug("Unexpected event or received data. Check output.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +118,7 @@ public class SendFailed {
|
|||||||
{
|
{
|
||||||
/** Reference to the buffer captured in send failed notification */
|
/** Reference to the buffer captured in send failed notification */
|
||||||
private ByteBuffer sentBuffer;
|
private ByteBuffer sentBuffer;
|
||||||
|
boolean receivedSendFailed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerResult handleNotification(
|
public HandlerResult handleNotification(
|
||||||
@ -135,6 +141,7 @@ public class SendFailed {
|
|||||||
public HandlerResult handleNotification(
|
public HandlerResult handleNotification(
|
||||||
SendFailedNotification notification, Object attachment) {
|
SendFailedNotification notification, Object attachment) {
|
||||||
debug("%nSendFailedNotification: %s. ", notification);
|
debug("%nSendFailedNotification: %s. ", notification);
|
||||||
|
receivedSendFailed = true;
|
||||||
sentBuffer = notification.buffer();
|
sentBuffer = notification.buffer();
|
||||||
return HandlerResult.RETURN;
|
return HandlerResult.RETURN;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ public class SocketOptionTests {
|
|||||||
|
|
||||||
/* SCTP_PRIMARY_ADDR */
|
/* SCTP_PRIMARY_ADDR */
|
||||||
void sctpPrimaryAddr() throws IOException {
|
void sctpPrimaryAddr() throws IOException {
|
||||||
SocketAddress addrToSet = null;
|
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(Util.SMALL_BUFFER);
|
ByteBuffer buffer = ByteBuffer.allocate(Util.SMALL_BUFFER);
|
||||||
|
|
||||||
System.out.println("TESTING SCTP_PRIMARY_ADDR");
|
System.out.println("TESTING SCTP_PRIMARY_ADDR");
|
||||||
@ -189,12 +188,11 @@ public class SocketOptionTests {
|
|||||||
|
|
||||||
SctpChannel peerChannel = ssc.accept();
|
SctpChannel peerChannel = ssc.accept();
|
||||||
ssc.close();
|
ssc.close();
|
||||||
Set<SocketAddress> peerAddrs = peerChannel.getAllLocalAddresses();
|
Set<SocketAddress> remoteAddresses = smc.getRemoteAddresses(assoc);
|
||||||
debug("Peer local Addresses: ");
|
debug("Remote Addresses: ");
|
||||||
for (Iterator<SocketAddress> it = peerAddrs.iterator(); it.hasNext(); ) {
|
for (Iterator<SocketAddress> it = remoteAddresses.iterator(); it.hasNext(); ) {
|
||||||
InetSocketAddress addr = (InetSocketAddress)it.next();
|
InetSocketAddress addr = (InetSocketAddress)it.next();
|
||||||
debug("\t" + addr);
|
debug("\t" + addr);
|
||||||
addrToSet = addr; // any of the peer addresses will do!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */
|
/* retrieval of SCTP_PRIMARY_ADDR is not supported on Solaris */
|
||||||
@ -207,19 +205,12 @@ public class SocketOptionTests {
|
|||||||
} else { /* Linux */
|
} else { /* Linux */
|
||||||
SocketAddress primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc);
|
SocketAddress primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc);
|
||||||
System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr);
|
System.out.println("SCTP_PRIMARY_ADDR returned: " + primaryAddr);
|
||||||
/* Verify that this is one of the peer addresses */
|
/* Verify that this is one of the remote addresses */
|
||||||
boolean found = false;
|
check(remoteAddresses.contains(primaryAddr), "SCTP_PRIMARY_ADDR returned bogus address!");
|
||||||
addrToSet = primaryAddr; // may not have more than one addr
|
|
||||||
for (Iterator<SocketAddress> it = peerAddrs.iterator(); it.hasNext(); ) {
|
|
||||||
InetSocketAddress addr = (InetSocketAddress)it.next();
|
|
||||||
if (addr.equals(primaryAddr)) {
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
addrToSet = addr;
|
|
||||||
}
|
|
||||||
check(found, "SCTP_PRIMARY_ADDR returned bogus address!");
|
|
||||||
|
|
||||||
System.out.println("Try SCTP_PRIMARY_ADDR set to: " + addrToSet);
|
for (Iterator<SocketAddress> it = remoteAddresses.iterator(); it.hasNext(); ) {
|
||||||
|
InetSocketAddress addrToSet = (InetSocketAddress) it.next();
|
||||||
|
System.out.println("SCTP_PRIMARY_ADDR try set to: " + addrToSet);
|
||||||
smc.setOption(SCTP_PRIMARY_ADDR, addrToSet, assoc);
|
smc.setOption(SCTP_PRIMARY_ADDR, addrToSet, assoc);
|
||||||
System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet);
|
System.out.println("SCTP_PRIMARY_ADDR set to : " + addrToSet);
|
||||||
primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc);
|
primaryAddr = smc.getOption(SCTP_PRIMARY_ADDR, assoc);
|
||||||
@ -227,6 +218,9 @@ public class SocketOptionTests {
|
|||||||
check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly");
|
check(addrToSet.equals(primaryAddr), "SCTP_PRIMARY_ADDR not set correctly");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
smc.close();
|
||||||
|
peerChannel.close();
|
||||||
|
}
|
||||||
|
|
||||||
class SOTNotificationHandler extends AbstractNotificationHandler<Object>
|
class SOTNotificationHandler extends AbstractNotificationHandler<Object>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user