Fix potential resource leak in SslHandler

- Fixes: #1116
This commit is contained in:
Trustin Lee 2013-03-04 14:40:45 +09:00
parent c4f372b111
commit e15ca4947e

View File

@ -1414,7 +1414,7 @@ public class SslHandler extends FrameDecoder
return; return;
} }
boolean success = false; boolean passthrough = true;
try { try {
try { try {
unwrap(context, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0); unwrap(context, e.getChannel(), ChannelBuffers.EMPTY_BUFFER, 0, 0);
@ -1431,18 +1431,16 @@ public class SslHandler extends FrameDecoder
ChannelFuture closeNotifyFuture = wrapNonAppData(context, e.getChannel()); ChannelFuture closeNotifyFuture = wrapNonAppData(context, e.getChannel());
closeNotifyFuture.addListener( closeNotifyFuture.addListener(
new ClosingChannelFutureListener(context, e)); new ClosingChannelFutureListener(context, e));
success = true; passthrough = false;
} catch (SSLException ex) { } catch (SSLException ex) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Failed to encode a close_notify message", ex); logger.debug("Failed to encode a close_notify message", ex);
} }
} }
} }
} else {
success = true;
} }
} finally { } finally {
if (!success) { if (passthrough) {
context.sendDownstream(e); context.sendDownstream(e);
} }
} }