private void AsyncResumeHandshakeRead(object state)
{
AsyncProtocolRequest asyncRequest = (AsyncProtocolRequest)state;
try
{
if (_pendingReHandshake)
{
// Resume as read a blob.
StartReceiveBlob(asyncRequest.Buffer, asyncRequest);
}
else
{
// Resume as process the blob.
ProcessReceivedBlob(asyncRequest.Buffer, asyncRequest.Buffer == null ? 0 : asyncRequest.Buffer.Length, asyncRequest);
}
}
catch (Exception e)
{
if (asyncRequest.IsUserCompleted)
{
// This will throw on a worker thread.
throw;
}
FinishHandshake(e, asyncRequest);
}
}