Renamed CONNECTION_RESET to IGNORABLE_ERROR_MESSAGE

This commit is contained in:
Trustin Lee 2009-04-15 22:09:57 +00:00
parent 86a2c0c0ce
commit 7d8d924f6b

View File

@ -109,7 +109,7 @@ public class SslHandler extends FrameDecoder {
private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0); private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
private static final Pattern CONNECTION_RESET = Pattern.compile( private static final Pattern IGNORABLE_ERROR_MESSAGE = Pattern.compile(
"^.*(?:Connection\\s*reset|Broken\\s*pipe).*$", "^.*(?:Connection\\s*reset|Broken\\s*pipe).*$",
Pattern.CASE_INSENSITIVE); Pattern.CASE_INSENSITIVE);
@ -394,12 +394,13 @@ public class SslHandler extends FrameDecoder {
} }
} else if (engine.isOutboundDone()) { } else if (engine.isOutboundDone()) {
String message = String.valueOf(cause.getMessage()).toLowerCase(); String message = String.valueOf(cause.getMessage()).toLowerCase();
if (CONNECTION_RESET.matcher(message).matches()) { if (IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
// It is safe to ignore the 'connection reset by peer' error // It is safe to ignore the 'connection reset by peer' or
// after sending closure_notify. // 'broken pipe' error after sending closure_notify.
logger.debug( logger.debug(
"Swallowing a 'connection reset by peer' error " + "Swallowing a 'connection reset by peer / " +
"occurred while writing 'closure_notify'", cause); "broken pipe' error occurred while writing " +
"'closure_notify'", cause);
// Close the connection explicitly just in case the transport // Close the connection explicitly just in case the transport
// did not close the connection automatically. // did not close the connection automatically.