From c0ddac2c831eba951cb28d3a27a4ce50e5f793f4 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 2 Sep 2020 10:25:03 +0200 Subject: [PATCH] Correctly obtain localAddress after connect was complete Motivation: We need to cache the localAddress after the connect was complete Modifications: - Call socket.localAddress() after the connect was complete - Enable test again Result: Correctly set localAddress after connect was successful --- .../io/netty/channel/uring/AbstractIOUringChannel.java | 3 +++ .../netty/channel/uring/IOUringSocketConnectTest.java | 10 ---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java index d7cf28e04b..07fe2a0860 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java @@ -371,6 +371,9 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha } active = true; + if (local == null) { + local = socket.localAddress(); + } computeRemote(); // Register POLLRDHUP diff --git a/transport-native-io_uring/src/test/java/io/netty/channel/uring/IOUringSocketConnectTest.java b/transport-native-io_uring/src/test/java/io/netty/channel/uring/IOUringSocketConnectTest.java index 9c8f87dc64..6e348748fa 100644 --- a/transport-native-io_uring/src/test/java/io/netty/channel/uring/IOUringSocketConnectTest.java +++ b/transport-native-io_uring/src/test/java/io/netty/channel/uring/IOUringSocketConnectTest.java @@ -19,8 +19,6 @@ import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.ServerBootstrap; import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.socket.SocketConnectTest; -import org.junit.Ignore; -import org.junit.Test; import java.util.List; @@ -29,12 +27,4 @@ public class IOUringSocketConnectTest extends SocketConnectTest { protected List> newFactories() { return IOUringSocketTestPermutation.INSTANCE.socket(); } - - @Ignore - @Test - @Override - public void testLocalAddressAfterConnect() throws Throwable { - super.testLocalAddressAfterConnect(); - } - }