* Removed output to stderr
* Made sure SSLEngine is cleaned up when a handler in the downstream raises an exception.
This commit is contained in:
parent
630473bf84
commit
72ab3f04b0
@ -49,6 +49,8 @@ import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -98,6 +100,9 @@ import org.jboss.netty.util.ImmediateExecutor;
|
||||
*/
|
||||
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 SslBufferPool defaultBufferPool;
|
||||
@ -349,14 +354,17 @@ public class SslHandler extends FrameDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
super.channelDisconnected(ctx, e);
|
||||
unwrap(ctx, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0);
|
||||
engine.closeOutbound();
|
||||
if (!sentCloseNotify.get() && handshaken) {
|
||||
try {
|
||||
engine.closeInbound();
|
||||
} catch (SSLException ex) {
|
||||
ex.printStackTrace();
|
||||
try {
|
||||
super.channelDisconnected(ctx, e);
|
||||
} finally {
|
||||
unwrap(ctx, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0);
|
||||
engine.closeOutbound();
|
||||
if (!sentCloseNotify.get() && handshaken) {
|
||||
try {
|
||||
engine.closeInbound();
|
||||
} catch (SSLException ex) {
|
||||
logger.debug("Failed to clean up SSLEngine.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user