Fixed a bug where HttpTunnelingClientSocketChannel's closeFuture is not notified if the connection is closed by the client

This commit is contained in:
Trustin Lee 2010-05-27 12:02:49 +00:00
parent be544fa899
commit d65cd371e7

View File

@ -309,11 +309,19 @@ class HttpTunnelingClientSocketChannel extends AbstractChannel
public void operationComplete(ChannelFuture f) {
realChannel.close().addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture f) {
// Note: If 'future' refers to the closeFuture,
// setSuccess() and setFailure() do nothing.
// AbstractChannel.setClosed() should be called instead.
// (See AbstractChannel.ChannelCloseFuture)
if (f.isSuccess()) {
future.setSuccess();
} else {
future.setFailure(f.getCause());
}
// Notify the closeFuture.
setClosed();
}
});
}