diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java index 15a9cfb38f..49dc5acefc 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java @@ -51,10 +51,14 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel { protected AbstractEpollStreamChannel(Channel parent, int fd) { super(parent, fd, Native.EPOLLIN, true); + // Add EPOLLRDHUP so we are notified once the remote peer close the connection. + flags |= Native.EPOLLRDHUP; } protected AbstractEpollStreamChannel(int fd) { super(fd, Native.EPOLLIN); + // Add EPOLLRDHUP so we are notified once the remote peer close the connection. + flags |= Native.EPOLLRDHUP; } @Override 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 f1b0407eeb..36d1e37e4e 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 @@ -37,8 +37,6 @@ public final class EpollSocketChannel extends AbstractEpollStreamChannel impleme EpollSocketChannel(Channel parent, int fd) { super(parent, fd); - // Add EPOLLRDHUP so we are notified once the remote peer close the connection. - flags |= Native.EPOLLRDHUP; config = new EpollSocketChannelConfig(this); // Directly cache the remote and local addresses // See https://github.com/netty/netty/issues/2359 @@ -48,8 +46,6 @@ public final class EpollSocketChannel extends AbstractEpollStreamChannel impleme public EpollSocketChannel() { super(Native.socketStreamFd()); - // Add EPOLLRDHUP so we are notified once the remote peer close the connection. - flags |= Native.EPOLLRDHUP; config = new EpollSocketChannelConfig(this); }