Fix SocketException in NioSocketChannelUnsafe.closeExecutor()

Related: #3464

Motivation:

When a connection attempt is failed,
NioSocketChannelUnsafe.closeExecutor() triggers a SocketException,
suppressing the channelUnregistered() event.

Modification:

Do not attempt to get SO_LINGER value when a socket is not open yet.

Result:

One less bug
This commit is contained in:
Trustin Lee 2015-03-05 15:14:59 +09:00
parent 1a83232ab2
commit 068132f1ea

View File

@ -332,7 +332,7 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty
private final class NioSocketChannelUnsafe extends NioByteUnsafe {
@Override
protected Executor closeExecutor() {
if (config().getSoLinger() > 0) {
if (javaChannel().isOpen() && config().getSoLinger() > 0) {
return GlobalEventExecutor.INSTANCE;
}
return null;