private static void ReadFrameCallback(AsyncProtocolRequest asyncRequest)
{
if (NetEventSource.IsEnabled) NetEventSource.Enter(null);
// Async ONLY completion.
SslState sslState = (SslState)asyncRequest.AsyncObject;
try
{
if (asyncRequest.Result == 0)
{
//EOF received: will fail.
asyncRequest.Offset = 0;
}
sslState.ProcessReceivedBlob(asyncRequest.Buffer, asyncRequest.Offset + asyncRequest.Result, asyncRequest);
}
catch (Exception e)
{
if (asyncRequest.IsUserCompleted)
{
// This will throw on a worker thread.
throw;
}
sslState.FinishHandshake(e, asyncRequest);
}
}