Issue #2135 - TLS on Android 8.1 workaround configuration for Direct ByteBuffer use

+ Changes from review with @sbordet

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2018-06-06 10:55:28 -05:00
parent ea116028d4
commit 2d5ef67d3f
2 changed files with 30 additions and 10 deletions

View File

@ -39,8 +39,8 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
private final ByteBufferPool byteBufferPool;
private final Executor executor;
private final ClientConnectionFactory connectionFactory;
private boolean _useDirectBuffersForEncryption = false;
private boolean _useDirectBuffersForDecryption = false;
private boolean _directBuffersForEncryption = true;
private boolean _directBuffersForDecryption = true;
public SslClientConnectionFactory(SslContextFactory sslContextFactory, ByteBufferPool byteBufferPool, Executor executor, ClientConnectionFactory connectionFactory)
{
@ -52,12 +52,22 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
{
this._useDirectBuffersForEncryption = useDirectBuffers;
this._directBuffersForEncryption = useDirectBuffers;
}
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
{
this._useDirectBuffersForDecryption = useDirectBuffers;
this._directBuffersForDecryption = useDirectBuffers;
}
public boolean isDirectBuffersForDecryption()
{
return _directBuffersForDecryption;
}
public boolean isDirectBuffersForEncryption()
{
return _directBuffersForEncryption;
}
@Override
@ -80,6 +90,6 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
protected SslConnection newSslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine engine)
{
return new SslConnection(byteBufferPool, executor, endPoint, engine, _useDirectBuffersForEncryption, _useDirectBuffersForDecryption);
return new SslConnection(byteBufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption());
}
}

View File

@ -34,8 +34,8 @@ public class SslConnectionFactory extends AbstractConnectionFactory
{
private final SslContextFactory _sslContextFactory;
private final String _nextProtocol;
private boolean _useDirectBuffersForEncryption = false;
private boolean _useDirectBuffersForDecryption = false;
private boolean _directBuffersForEncryption = false;
private boolean _directBuffersForDecryption = false;
public SslConnectionFactory()
{
@ -62,12 +62,22 @@ public class SslConnectionFactory extends AbstractConnectionFactory
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
{
this._useDirectBuffersForEncryption = useDirectBuffers;
this._directBuffersForEncryption = useDirectBuffers;
}
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
{
this._useDirectBuffersForDecryption = useDirectBuffers;
this._directBuffersForDecryption = useDirectBuffers;
}
public boolean isDirectBuffersForDecryption()
{
return _directBuffersForDecryption;
}
public boolean isDirectBuffersForEncryption()
{
return _directBuffersForEncryption;
}
@Override
@ -103,7 +113,7 @@ public class SslConnectionFactory extends AbstractConnectionFactory
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine)
{
return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, _useDirectBuffersForEncryption, _useDirectBuffersForDecryption);
return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption());
}
@Override