From fc5d20ff2d4d7c22200f70bc20c690821f7c78ca Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 10 Mar 2014 20:27:44 +0100 Subject: [PATCH] [#2297] Correctly close all registered Channels on EpollEventLoop.closeAll() --- .../io/netty/channel/epoll/EpollEventLoop.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java index 94211760fa..5a5d68ef70 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java @@ -289,17 +289,11 @@ final class EpollEventLoop extends SingleThreadEventLoop { } private void closeAll() { - int ready = Native.epollWait(epollFd, events, 0); - Collection channels = new ArrayList(ready); + Native.epollWait(epollFd, events, 0); + Collection channels = new ArrayList(ids.size()); - for (int i = 0; i < ready; i++) { - final long ev = events[i]; - - int id = (int) (ev >> 32L); - AbstractEpollChannel ch = ids.get(id); - if (ch != null) { - channels.add(ids.get(id)); - } + for (AbstractEpollChannel ch: ids.values()) { + channels.add(ch); } for (AbstractEpollChannel ch: channels) {