public byte[] Compile(out int length) { if (mCompiledBuffer == null) { if ((mState & EPacketState.Accessed) == 0) { mState |= EPacketState.Accessed; } else { if ((mState & EPacketState.Warned) == 0) { mState |= EPacketState.Warned; try { using (StreamWriter op = new StreamWriter("net_opt.log", true)) { op.WriteLine("Redundant compile for packet {0}, use Acquire() and Release()", this.GetType()); op.WriteLine(new System.Diagnostics.StackTrace()); } } catch { } } mCompiledBuffer = new byte[0]; mCompiledLength = 0; length = mCompiledLength; return(mCompiledBuffer); } InternalCompile(); } length = mCompiledLength; return(mCompiledBuffer); }
private void Free() { if (mCompiledBuffer == null) { return; } if ((mState & EPacketState.Buffered) != 0) { mBuffers.ReleaseBuffer(mCompiledBuffer); } mState &= ~(EPacketState.Static | EPacketState.Acquired | EPacketState.Buffered); mCompiledBuffer = null; }
public void Acquire() { mState |= EPacketState.Acquired; }
public void SetStatic() { mState |= EPacketState.Static | EPacketState.Acquired; }
public byte[] Compile(out int length) { if (mCompiledBuffer == null) { if ((mState & EPacketState.Accessed) == 0) { mState |= EPacketState.Accessed; } else { if ((mState & EPacketState.Warned) == 0) { mState |= EPacketState.Warned; try { using (var op = new StreamWriter("net_opt.log", true)) { op.WriteLine("Redundant compile for packet {0}, use Acquire() and Release()", GetType()); op.WriteLine(new System.Diagnostics.StackTrace()); } } catch { } } mCompiledBuffer = new byte[0]; mCompiledLength = 0; length = mCompiledLength; return mCompiledBuffer; } InternalCompile(); } length = mCompiledLength; return mCompiledBuffer; }
private void Free() { if (mCompiledBuffer == null) return; if ((mState & EPacketState.Buffered) != 0) mBuffers.ReleaseBuffer(mCompiledBuffer); mState &= ~(EPacketState.Static | EPacketState.Acquired | EPacketState.Buffered); mCompiledBuffer = null; }
public void Acquire() { mState |= EPacketState.Acquired; }
public void SetStatic() { mState |= EPacketState.Static | EPacketState.Acquired; }