[#857] Check if the SelectionKey is valid before access readyOps()

This commit is contained in:
Norman Maurer 2012-12-29 18:07:02 +01:00
parent 64351ad7d6
commit e2b240799c

View File

@ -383,6 +383,12 @@ public final class NioEventLoop extends SingleThreadEventLoop {
private static void processSelectedKey(SelectionKey k, AbstractNioChannel ch) {
final NioUnsafe unsafe = ch.unsafe();
if (!k.isValid()) {
// close the channel if the key is not valid anymore
unsafe.close(unsafe.voidFuture());
return;
}
int readyOps = -1;
try {
readyOps = k.readyOps();