Ejemplo n.º 1
0
            private void ChangeQuota(ref InternalBufferManager.PooledBufferManager.BufferPool bufferPool, int delta)
            {
                if (TraceCore.BufferPoolChangeQuotaIsEnabled(Fx.Trace))
                {
                    TraceCore.BufferPoolChangeQuota(Fx.Trace, bufferPool.BufferSize, delta);
                }
                InternalBufferManager.PooledBufferManager.BufferPool bufferPool2 = bufferPool;
                int num = bufferPool2.Limit + delta;

                InternalBufferManager.PooledBufferManager.BufferPool bufferPool3 = InternalBufferManager.PooledBufferManager.BufferPool.CreatePool(bufferPool2.BufferSize, num);
                for (int i = 0; i < num; i++)
                {
                    byte[] array = bufferPool2.Take();
                    if (array == null)
                    {
                        break;
                    }
                    bufferPool3.Return(array);
                    bufferPool3.IncrementCount();
                }
                this.remainingMemory -= (long)(bufferPool2.BufferSize * delta);
                bufferPool            = bufferPool3;
            }