diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index 93c0ac02dc..b333c498dd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -635,6 +635,7 @@ class NioWorker implements Runnable { if (future != null) { future.setFailure(new ClosedChannelException()); } + close(channel, channel.getSucceededFuture()); return; } @@ -644,7 +645,10 @@ class NioWorker implements Runnable { future.setSuccess(); } } catch (ClosedChannelException e) { - future.setFailure(e); + if (future != null) { + future.setFailure(e); + } + close(channel, channel.getSucceededFuture()); throw new ChannelException( "Failed to register a socket to the selector.", e); }