Fixed ClosedChannelException caused by previous 'chunk end mark' fix

This commit is contained in:
Trustin Lee 2009-04-29 01:08:05 +00:00
parent fee1515818
commit d809046987

View File

@ -212,18 +212,20 @@ class HttpTunnelingClientSocketChannel extends AbstractChannel
}
void closeSocket() {
// Send the end of chunk.
synchronized (writeLock) {
ChannelFuture future = channel.write(ChannelBuffers.copiedBuffer(
"0" +
HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR +
HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR,
"ASCII"));
future.awaitUninterruptibly();
if (setClosed()) {
// Send the end of chunk.
synchronized (writeLock) {
ChannelFuture future = channel.write(ChannelBuffers.copiedBuffer(
"0" +
HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR +
HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR,
"ASCII"));
future.awaitUninterruptibly();
}
closed = true;
channel.close();
}
setClosed();
closed = true;
channel.close();
}
void bindSocket(SocketAddress localAddress) {