[#2297] Correctly close all registered Channels on EpollEventLoop.closeAll()

This commit is contained in:
Norman Maurer 2014-03-10 20:27:44 +01:00
parent 4f069e5c36
commit d63c9f2bdb

View File

@ -289,17 +289,11 @@ final class EpollEventLoop extends SingleThreadEventLoop {
}
private void closeAll() {
int ready = Native.epollWait(epollFd, events, 0);
Collection<AbstractEpollChannel> channels = new ArrayList<AbstractEpollChannel>(ready);
Native.epollWait(epollFd, events, 0);
Collection<AbstractEpollChannel> channels = new ArrayList<AbstractEpollChannel>(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) {