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:
parent
ea116028d4
commit
2d5ef67d3f
|
@ -39,8 +39,8 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
|
||||||
private final ByteBufferPool byteBufferPool;
|
private final ByteBufferPool byteBufferPool;
|
||||||
private final Executor executor;
|
private final Executor executor;
|
||||||
private final ClientConnectionFactory connectionFactory;
|
private final ClientConnectionFactory connectionFactory;
|
||||||
private boolean _useDirectBuffersForEncryption = false;
|
private boolean _directBuffersForEncryption = true;
|
||||||
private boolean _useDirectBuffersForDecryption = false;
|
private boolean _directBuffersForDecryption = true;
|
||||||
|
|
||||||
public SslClientConnectionFactory(SslContextFactory sslContextFactory, ByteBufferPool byteBufferPool, Executor executor, ClientConnectionFactory connectionFactory)
|
public SslClientConnectionFactory(SslContextFactory sslContextFactory, ByteBufferPool byteBufferPool, Executor executor, ClientConnectionFactory connectionFactory)
|
||||||
{
|
{
|
||||||
|
@ -52,12 +52,22 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
|
||||||
|
|
||||||
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
|
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
|
||||||
{
|
{
|
||||||
this._useDirectBuffersForEncryption = useDirectBuffers;
|
this._directBuffersForEncryption = useDirectBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
|
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
|
||||||
{
|
{
|
||||||
this._useDirectBuffersForDecryption = useDirectBuffers;
|
this._directBuffersForDecryption = useDirectBuffers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDirectBuffersForDecryption()
|
||||||
|
{
|
||||||
|
return _directBuffersForDecryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDirectBuffersForEncryption()
|
||||||
|
{
|
||||||
|
return _directBuffersForEncryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,6 +90,6 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
|
||||||
|
|
||||||
protected SslConnection newSslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine engine)
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class SslConnectionFactory extends AbstractConnectionFactory
|
||||||
{
|
{
|
||||||
private final SslContextFactory _sslContextFactory;
|
private final SslContextFactory _sslContextFactory;
|
||||||
private final String _nextProtocol;
|
private final String _nextProtocol;
|
||||||
private boolean _useDirectBuffersForEncryption = false;
|
private boolean _directBuffersForEncryption = false;
|
||||||
private boolean _useDirectBuffersForDecryption = false;
|
private boolean _directBuffersForDecryption = false;
|
||||||
|
|
||||||
public SslConnectionFactory()
|
public SslConnectionFactory()
|
||||||
{
|
{
|
||||||
|
@ -62,12 +62,22 @@ public class SslConnectionFactory extends AbstractConnectionFactory
|
||||||
|
|
||||||
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
|
public void setDirectBuffersForEncryption(boolean useDirectBuffers)
|
||||||
{
|
{
|
||||||
this._useDirectBuffersForEncryption = useDirectBuffers;
|
this._directBuffersForEncryption = useDirectBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
|
public void setDirectBuffersForDecryption(boolean useDirectBuffers)
|
||||||
{
|
{
|
||||||
this._useDirectBuffersForDecryption = useDirectBuffers;
|
this._directBuffersForDecryption = useDirectBuffers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDirectBuffersForDecryption()
|
||||||
|
{
|
||||||
|
return _directBuffersForDecryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDirectBuffersForEncryption()
|
||||||
|
{
|
||||||
|
return _directBuffersForEncryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +113,7 @@ public class SslConnectionFactory extends AbstractConnectionFactory
|
||||||
|
|
||||||
protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine)
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue