Issue #1062 Ssl Nonblocking read callback

This commit is contained in:
Greg Wilkins 2016-11-10 09:56:57 +11:00
parent c499ec68f7
commit 3b36b13d31
1 changed files with 32 additions and 2 deletions

View File

@ -109,6 +109,27 @@ public class SslConnection extends AbstractConnection
_decryptedEndPoint.getFillInterest().fillable();
}
};
Callback _nonBlockingReadCallback = new Callback.NonBlocking()
{
@Override
public void succeeded()
{
onFillable();
}
@Override
public void failed(final Throwable x)
{
onFillInterestedFailed(x);
}
@Override
public String toString()
{
return String.format("SSLC.NBReadCB@%x{%s}", SslConnection.this.hashCode(),SslConnection.this);
}
};
public SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine)
{
@ -944,11 +965,20 @@ public class SslConnection extends AbstractConnection
getEndPoint().close();
}
}
private void ensureFillInterested()
{
if (!SslConnection.this.isFillInterested())
SslConnection.this.fillInterested();
{
if (getFillInterest().isCallbackNonBlocking())
{
SslConnection.this.getEndPoint().fillInterested(_nonBlockingReadCallback);
}
else
{
SslConnection.this.fillInterested();
}
}
}
@Override