Fixed unnecessary duplicate handshake exception

This commit is contained in:
Trustin Lee 2009-07-20 05:35:53 +00:00
parent 2d4dfeffaa
commit 96aee007cc

View File

@ -316,7 +316,7 @@ public class SslHandler extends FrameDecoder implements ChannelDownstreamHandler
} else { } else {
engine.beginHandshake(); engine.beginHandshake();
runDelegatedTasks(); runDelegatedTasks();
handshakeFuture = this.handshakeFuture = newHandshakeFuture(channel); handshakeFuture = this.handshakeFuture = future(channel);
handshaking = true; handshaking = true;
} }
} }
@ -840,7 +840,7 @@ public class SslHandler extends FrameDecoder implements ChannelDownstreamHandler
handshaken = true; handshaken = true;
if (handshakeFuture == null) { if (handshakeFuture == null) {
handshakeFuture = newHandshakeFuture(channel); handshakeFuture = future(channel);
} }
} }
@ -856,7 +856,7 @@ public class SslHandler extends FrameDecoder implements ChannelDownstreamHandler
handshaken = false; handshaken = false;
if (handshakeFuture == null) { if (handshakeFuture == null) {
handshakeFuture = newHandshakeFuture(channel); handshakeFuture = future(channel);
} }
} }
handshakeFuture.setFailure(cause); handshakeFuture.setFailure(cause);
@ -883,19 +883,6 @@ public class SslHandler extends FrameDecoder implements ChannelDownstreamHandler
context.sendDownstream(e); context.sendDownstream(e);
} }
private static ChannelFuture newHandshakeFuture(Channel channel) {
ChannelFuture future = future(channel);
future.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future)
throws Exception {
if (!future.isSuccess()) {
fireExceptionCaught(future.getChannel(), future.getCause());
}
}
});
return future;
}
private static final class PendingWrite { private static final class PendingWrite {
final ChannelFuture future; final ChannelFuture future;
final ByteBuffer outAppBuf; final ByteBuffer outAppBuf;