* Removed output to stderr

* Made sure SSLEngine is cleaned up when a handler in the downstream raises an exception.
This commit is contained in:
Trustin Lee 2008-11-16 14:43:49 +00:00
parent 630473bf84
commit 72ab3f04b0

View File

@ -49,6 +49,8 @@ import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.codec.frame.FrameDecoder; import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
import org.jboss.netty.util.ImmediateExecutor; import org.jboss.netty.util.ImmediateExecutor;
/** /**
@ -98,6 +100,9 @@ import org.jboss.netty.util.ImmediateExecutor;
*/ */
public class SslHandler extends FrameDecoder { public class SslHandler extends FrameDecoder {
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(SslHandler.class);
private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0); private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
private static SslBufferPool defaultBufferPool; private static SslBufferPool defaultBufferPool;
@ -349,14 +354,17 @@ public class SslHandler extends FrameDecoder {
} }
} }
try {
super.channelDisconnected(ctx, e); super.channelDisconnected(ctx, e);
} finally {
unwrap(ctx, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0); unwrap(ctx, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0);
engine.closeOutbound(); engine.closeOutbound();
if (!sentCloseNotify.get() && handshaken) { if (!sentCloseNotify.get() && handshaken) {
try { try {
engine.closeInbound(); engine.closeInbound();
} catch (SSLException ex) { } catch (SSLException ex) {
ex.printStackTrace(); logger.debug("Failed to clean up SSLEngine.", ex);
}
} }
} }
} }