Should close the channel explicitly on connection attempt failure
This commit is contained in:
parent
f8aea1547e
commit
9c5a14b0c2
@ -142,8 +142,10 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
|||||||
channel.getCloseFuture().addListener(new ChannelFutureListener() {
|
channel.getCloseFuture().addListener(new ChannelFutureListener() {
|
||||||
public void operationComplete(ChannelFuture f)
|
public void operationComplete(ChannelFuture f)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
if (!cf.isDone()) {
|
||||||
cf.setFailure(new ClosedChannelException());
|
cf.setFailure(new ClosedChannelException());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
cf.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
|
cf.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
|
||||||
channel.connectFuture = cf;
|
channel.connectFuture = cf;
|
||||||
@ -153,6 +155,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
|
|||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
cf.setFailure(t);
|
cf.setFailure(t);
|
||||||
fireExceptionCaught(channel, t);
|
fireExceptionCaught(channel, t);
|
||||||
|
NioWorker.close(channel, succeededFuture(channel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user