jetty-9 - Removed the write of an empty buffer from onOpen().
SslConnection should remain as passive as possible, with the next connection driving the activity. If client connections need to drive the SSL handshake with an empty write, they should do it, and not SslConnection.
This commit is contained in:
parent
24cbb6385b
commit
b264f20dc9
|
@ -21,7 +21,6 @@ package org.eclipse.jetty.io.ssl;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.SocketChannel;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
|
@ -33,7 +32,6 @@ import javax.net.ssl.SSLException;
|
||||||
import org.eclipse.jetty.io.AbstractConnection;
|
import org.eclipse.jetty.io.AbstractConnection;
|
||||||
import org.eclipse.jetty.io.AbstractEndPoint;
|
import org.eclipse.jetty.io.AbstractEndPoint;
|
||||||
import org.eclipse.jetty.io.ByteBufferPool;
|
import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
import org.eclipse.jetty.io.ChannelEndPoint;
|
|
||||||
import org.eclipse.jetty.io.Connection;
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
import org.eclipse.jetty.io.EofException;
|
import org.eclipse.jetty.io.EofException;
|
||||||
|
@ -115,7 +113,7 @@ public class SslConnection extends AbstractConnection
|
||||||
this._bufferPool = byteBufferPool;
|
this._bufferPool = byteBufferPool;
|
||||||
this._sslEngine = sslEngine;
|
this._sslEngine = sslEngine;
|
||||||
this._decryptedEndPoint = new DecryptedEndPoint();
|
this._decryptedEndPoint = new DecryptedEndPoint();
|
||||||
|
|
||||||
if (endPoint instanceof SocketBased)
|
if (endPoint instanceof SocketBased)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -149,8 +147,9 @@ public class SslConnection extends AbstractConnection
|
||||||
// Begin the handshake
|
// Begin the handshake
|
||||||
_sslEngine.beginHandshake();
|
_sslEngine.beginHandshake();
|
||||||
|
|
||||||
if (_sslEngine.getUseClientMode())
|
// TODO: check that it is ok to remove this code
|
||||||
getExecutor().execute(_runWriteEmpty);
|
// if (_sslEngine.getUseClientMode())
|
||||||
|
// getExecutor().execute(_runWriteEmpty);
|
||||||
}
|
}
|
||||||
catch (SSLException x)
|
catch (SSLException x)
|
||||||
{
|
{
|
||||||
|
@ -223,12 +222,12 @@ public class SslConnection extends AbstractConnection
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
ByteBuffer b = _encryptedInput;
|
ByteBuffer b = _encryptedInput;
|
||||||
int ei=b==null?-1:b.remaining();
|
int ei=b==null?-1:b.remaining();
|
||||||
b = _encryptedOutput;
|
b = _encryptedOutput;
|
||||||
int eo=b==null?-1:b.remaining();
|
int eo=b==null?-1:b.remaining();
|
||||||
b = _decryptedInput;
|
b = _decryptedInput;
|
||||||
int di=b==null?-1:b.remaining();
|
int di=b==null?-1:b.remaining();
|
||||||
|
|
||||||
return String.format("SslConnection@%x{%s,eio=%d/%d,di=%d} -> %s",
|
return String.format("SslConnection@%x{%s,eio=%d/%d,di=%d} -> %s",
|
||||||
hashCode(),
|
hashCode(),
|
||||||
_sslEngine.getHandshakeStatus(),
|
_sslEngine.getHandshakeStatus(),
|
||||||
|
@ -418,7 +417,7 @@ public class SslConnection extends AbstractConnection
|
||||||
if (connection instanceof AbstractConnection)
|
if (connection instanceof AbstractConnection)
|
||||||
{
|
{
|
||||||
AbstractConnection a = (AbstractConnection)connection;
|
AbstractConnection a = (AbstractConnection)connection;
|
||||||
if (a.getInputBufferSize()<_sslEngine.getSession().getApplicationBufferSize());
|
if (a.getInputBufferSize()<_sslEngine.getSession().getApplicationBufferSize())
|
||||||
a.setInputBufferSize(_sslEngine.getSession().getApplicationBufferSize());
|
a.setInputBufferSize(_sslEngine.getSession().getApplicationBufferSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,7 +698,7 @@ public class SslConnection extends AbstractConnection
|
||||||
if (BufferUtil.hasContent(_encryptedOutput))
|
if (BufferUtil.hasContent(_encryptedOutput))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we have written, and the caller will close the underlying connection
|
// otherwise we have written, and the caller will close the underlying connection
|
||||||
return all_consumed;
|
return all_consumed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue