Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8259628: jdk/net/ExtendedSocketOption/AsynchronousSocketChannelNAPITe…
…st.java fails intermittently

Backport-of: 13ca433ff66e202710735134e072178557114ad4
  • Loading branch information
thejasviv authored and coffeys committed Feb 15, 2021
1 parent b6db9a5 commit c82a994a52c344609b5e511a921006cc5b4b8c14
Showing 1 changed file with 6 additions and 5 deletions.
@@ -95,7 +95,7 @@ public void testSetGetOptionServerSocketChannel() throws IOException {

@Test
public void testSocketChannel() throws Exception {
int socketID, clientID, tempID = 0;
int socketID, clientID, originalClientID = 0;
boolean initialRun = true;
try (var ss = AsynchronousServerSocketChannel.open()) {
ss.bind(new InetSocketAddress(hostAddr, 0));
@@ -108,20 +108,21 @@ public void testSocketChannel() throws Exception {

for (int i = 0; i < 10; i++) {
s.write(ByteBuffer.wrap("test".getBytes()));

socketID = s.getOption(SO_INCOMING_NAPI_ID);
assertEquals(socketID, 0, "AsynchronousSocketChannel: Sender");

c.read(ByteBuffer.allocate(128));
c.read(ByteBuffer.allocate(128)).get();
clientID = ss.getOption(SO_INCOMING_NAPI_ID);

// check ID remains consistent
if (initialRun) {
assertTrue(clientID >= 0, "AsynchronousSocketChannel: Receiver");
} else {
assertEquals(clientID, tempID);
initialRun = false;
originalClientID = clientID;
} else {
assertEquals(clientID, originalClientID);
}
tempID = clientID;
}
}
}

1 comment on commit c82a994

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c82a994 Feb 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.