Merged branch 'jetty-9.3.x' into 'master'.

This commit is contained in:
Simone Bordet 2016-01-04 13:14:06 +01:00
commit c14c54aaaa

View File

@ -78,7 +78,6 @@ import org.eclipse.jetty.util.log.Logger;
public class SslConnection extends AbstractConnection
{
private static final Logger LOG = Log.getLogger(SslConnection.class);
private static final boolean DEBUG = LOG.isDebugEnabled(); // Easy for the compiler to remove the code if DEBUG==false
private static final ByteBuffer __FILL_CALLED_FLUSH= BufferUtil.allocate(0);
private static final ByteBuffer __FLUSH_CALLED_FILL= BufferUtil.allocate(0);
private final ByteBufferPool _bufferPool;
@ -187,7 +186,7 @@ public class SslConnection extends AbstractConnection
// to do the fill and/or flush again and these calls will do the actually
// filling.
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("onFillable enter {}", _decryptedEndPoint);
// We have received a close handshake, close the end point to send FIN.
@ -208,7 +207,7 @@ public class SslConnection extends AbstractConnection
}
}
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("onFillable exit {}", _decryptedEndPoint);
}
@ -271,7 +270,7 @@ public class SslConnection extends AbstractConnection
boolean fillable = false;
synchronized (DecryptedEndPoint.this)
{
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("write.complete {}", SslConnection.this.getEndPoint());
releaseEncryptedOutputBuffer();
@ -298,7 +297,7 @@ public class SslConnection extends AbstractConnection
boolean fail_filler = false;
synchronized (DecryptedEndPoint.this)
{
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} write.failed", SslConnection.this, x);
BufferUtil.clear(_encryptedOutput);
releaseEncryptedOutputBuffer();
@ -386,7 +385,7 @@ public class SslConnection extends AbstractConnection
boolean try_again = false;
synchronized (DecryptedEndPoint.this)
{
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("onIncompleteFlush {}", SslConnection.this);
// If we have pending output data,
if (BufferUtil.hasContent(_encryptedOutput))
@ -543,7 +542,7 @@ public class SslConnection extends AbstractConnection
{
BufferUtil.flipToFlush(app_in, pos);
}
if (DEBUG)
if (LOG.isDebugEnabled())
{
LOG.debug("{} net={} unwrap {}", SslConnection.this, net_filled, unwrapResult.toString().replace('\n',' '));
LOG.debug("{} filled {}",SslConnection.this,BufferUtil.toHexSummary(buffer));
@ -606,7 +605,7 @@ public class SslConnection extends AbstractConnection
if (unwrapHandshakeStatus == HandshakeStatus.FINISHED && !_handshaken)
{
_handshaken = true;
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} {} handshook {}/{}", SslConnection.this,
_sslEngine.getUseClientMode() ? "client" : "resumed server",
_sslEngine.getSession().getProtocol(),_sslEngine.getSession().getCipherSuite());
@ -615,7 +614,7 @@ public class SslConnection extends AbstractConnection
// Check whether renegotiation is allowed
if (_handshaken && handshakeStatus != HandshakeStatus.NOT_HANDSHAKING && !isRenegotiationAllowed())
{
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} renegotiation denied", SslConnection.this);
closeInbound();
return -1;
@ -742,7 +741,7 @@ public class SslConnection extends AbstractConnection
// it is the applications responsibility to call flush again - either in a busy loop
// or better yet by using EndPoint#write to do the flushing.
if (DEBUG)
if (LOG.isDebugEnabled())
{
for (ByteBuffer b : appOuts)
LOG.debug("{} flush {}", SslConnection.this, BufferUtil.toHexSummary(b));
@ -775,7 +774,7 @@ public class SslConnection extends AbstractConnection
{
BufferUtil.flipToFlush(_encryptedOutput, pos);
}
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} wrap {}", SslConnection.this, wrapResult.toString().replace('\n',' '));
Status wrapResultStatus = wrapResult.getStatus();
@ -813,13 +812,13 @@ public class SslConnection extends AbstractConnection
throw new IllegalStateException();
default:
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} wrap {} {}", SslConnection.this, wrapResultStatus, BufferUtil.toHexSummary(_encryptedOutput));
if (wrapResult.getHandshakeStatus() == HandshakeStatus.FINISHED && !_handshaken)
{
_handshaken = true;
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} server handshook complete {}/{}", SslConnection.this, _sslEngine.getSession().getProtocol(),_sslEngine.getSession().getCipherSuite());
}
@ -828,7 +827,7 @@ public class SslConnection extends AbstractConnection
// Check whether renegotiation is allowed
if (_handshaken && handshakeStatus != HandshakeStatus.NOT_HANDSHAKING && !isRenegotiationAllowed())
{
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} renegotiation denied", SslConnection.this);
getEndPoint().shutdownOutput();
return allConsumed;
@ -902,7 +901,7 @@ public class SslConnection extends AbstractConnection
public void doShutdownOutput()
{
boolean ishut = isInputShutdown();
if (DEBUG)
if (LOG.isDebugEnabled())
LOG.debug("{} shutdownOutput: ishut={}", SslConnection.this, ishut);
if (ishut)
{