示例#1
0
        public override void ReturnPacket(SNIPacket packet)
        {
            Debug.Assert(packet != null, "releasing null SNIPacket");
#if DEBUG
            Debug.Assert(packet.IsActive, "SNIPacket _refcount must be 1 or a lifetime issue has occured, trace with the #TRACE_HISTORY define");
            Debug.Assert(ReferenceEquals(packet._owner, this), "releasing SNIPacket that belongs to another physical handle");
#endif
            Debug.Assert(!packet.IsInvalid, "releasing already released SNIPacket");

            packet.Release();
#if DEBUG
            Interlocked.Add(ref packet._refCount, -1);
            packet._traceTag = null;
            packet.AddHistory(false);
            GC.SuppressFinalize(packet);
#endif
            _pool.Return(packet);
        }