private void ReleaseBuffer(IOBuffer buf) { if (this.m_freeBuffers.Count >= 3 || !buf.PreAllocated) { IOBufferPool.Free(buf); return; } this.m_freeBuffers.Push(buf); }
// Token: 0x06000B93 RID: 2963 RVA: 0x00033628 File Offset: 0x00031828 private void SendPageNumbersToSource(object dummy) { Exception ex = null; IOBuffer iobuffer = null; int num = this.m_pageList.Length; try { this.GetChannel(); SeedPageReaderMultiplePageRequest seedPageReaderMultiplePageRequest = new SeedPageReaderMultiplePageRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath, (long)this.m_pageList.Length); seedPageReaderMultiplePageRequest.Send(); iobuffer = IOBufferPool.Allocate(); iobuffer.AppendOffset = 0; foreach (long num2 in this.m_pageList) { if (iobuffer.RemainingSpace >= 4) { DiagCore.RetailAssert(num2 <= 2147483647L, "ese uses 31bit page numbers but {0} was passed", new object[] { num2 }); ExBitConverter.Write((uint)num2, iobuffer.Buffer, iobuffer.AppendOffset); iobuffer.AppendOffset += 4; } else { this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset); iobuffer.AppendOffset = 0; } } if (iobuffer.AppendOffset > 0) { this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset); } } catch (NetworkRemoteException ex2) { ex = ex2; } catch (NetworkTransportException ex3) { ex = ex3; } finally { this.m_pageList = null; if (iobuffer != null) { IOBufferPool.Free(iobuffer); } } if (ex != null) { ReplayCrimsonEvents.SendPageNumbersToSourceFailed.Log <Guid, string, int, Exception>(this.m_databaseGuid, this.DatabaseName, num, ex); } }
private IOBuffer AcquireBuffer() { IOBuffer iobuffer; if (this.m_freeBuffers.Count > 0) { iobuffer = this.m_freeBuffers.Pop(); } else { iobuffer = IOBufferPool.Allocate(); } iobuffer.AppendOffset = 0; iobuffer.NextBuffer = null; return(iobuffer); }
private void FreeAllBuffers() { lock (this.m_bufferManangementLock) { while (this.m_oldestBuffer != null) { IOBuffer iobuffer = this.m_oldestBuffer; this.m_oldestBuffer = iobuffer.NextBuffer; IOBufferPool.Free(iobuffer); } this.m_currentBuffer = null; this.m_buffersInUseCount = 0; while (this.m_freeBuffers.Count > 0) { IOBuffer iobuffer = this.m_freeBuffers.Pop(); IOBufferPool.Free(iobuffer); } } }