private PooledStream Get(object owningObject, int result, ref bool continueLoop, ref WaitHandle[] waitHandles)
{
PooledStream fromPool = null;
int num2 = result;
switch (num2)
{
case 1:
{
int num = Interlocked.Decrement(ref this.m_WaitCount);
continueLoop = false;
Exception resError = this.m_ResError;
if (num == 0)
{
this.CancelErrorCallback();
}
throw resError;
}
case 2:
try
{
continueLoop = true;
fromPool = this.UserCreateRequest();
if (fromPool != null)
{
fromPool.PostPop(owningObject);
Interlocked.Decrement(ref this.m_WaitCount);
continueLoop = false;
return(fromPool);
}
if (((this.Count >= this.MaxPoolSize) && (this.MaxPoolSize != 0)) && !this.ReclaimEmancipatedObjects())
{
waitHandles = new WaitHandle[] { this.m_WaitHandles[0], this.m_WaitHandles[1] };
}
return(fromPool);
}
finally
{
this.CreationMutex.ReleaseMutex();
}
break;
default:
if (num2 == 0x102)
{
Interlocked.Decrement(ref this.m_WaitCount);
continueLoop = false;
throw new WebException(NetRes.GetWebStatusString("net_timeout", WebExceptionStatus.ConnectFailure), WebExceptionStatus.Timeout);
}
break;
}
Interlocked.Decrement(ref this.m_WaitCount);
fromPool = this.GetFromPool(owningObject);
continueLoop = false;
return(fromPool);
}