From d65cd371e7456f8acbf8af5dcb2166cce0e87b50 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 27 May 2010 12:02:49 +0000 Subject: [PATCH] Fixed a bug where HttpTunnelingClientSocketChannel's closeFuture is not notified if the connection is closed by the client --- .../socket/http/HttpTunnelingClientSocketChannel.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java index c9e95b949e..4475a37fc2 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java @@ -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(); } }); }