diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java index 40969464cd..e89b3a0f84 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannel.java @@ -66,9 +66,13 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So private volatile boolean inputShutdown; private volatile boolean outputShutdown; - EpollSocketChannel(Channel parent, int fd) { + EpollSocketChannel(Channel parent, int fd) throws IOException { super(parent, fd, Native.EPOLLIN, true); config = new EpollSocketChannelConfig(this); + // Directly cache the remote and local addresses + // See https://github.com/netty/netty/issues/2359 + remote = Native.remoteAddress(fd); + local = Native.localAddress(fd); } public EpollSocketChannel() {