private AsyncProtocolRequest GetOrCreateProtocolRequest(ref AsyncProtocolRequest aprField, LazyAsyncResult asyncResult)
{
AsyncProtocolRequest request = null;
if (asyncResult != null)
{
// SslStreamInternal supports only a single read and a single write operation at a time.
// As such, we can cache and reuse the AsyncProtocolRequest object that's used throughout
// the implementation.
request = aprField;
if (request != null)
{
request.Reset(asyncResult);
}
else
{
aprField = request = new AsyncProtocolRequest(asyncResult);
}
}
return request;
}