From 22cea8a2cc7c3082478f214876e8d06161307c59 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 16 Jul 2015 11:19:42 +0200 Subject: [PATCH] Correctly register for EPOLLRDHUP when construct EpollSocketChannel from FileDescriptor Motivation: We missed to register for EPOLLRDHUP events when construct the EpollSocketChannel from an existing FileDescriptor. This could cause to miss connection-resets. Modifications: Add Native.EPOLLRDHUP to the events we are interested in. Result: Connection-resets are detected correctly. --- .../io/netty/channel/epoll/AbstractEpollStreamChannel.java | 3 +++ 1 file changed, 3 insertions(+) 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 3f8363da59..98774cb819 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 @@ -92,6 +92,9 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel { protected AbstractEpollStreamChannel(FileDescriptor fd) { super(null, fd, Native.EPOLLIN, Native.getSoError(fd.intValue()) == 0); + + // Add EPOLLRDHUP so we are notified once the remote peer close the connection. + flags |= Native.EPOLLRDHUP; } @Override