protected virtual void Cleanup() { IPEndPoint = null; RemoteKey = null; ConnectionId = 0; this.formallyConnected = false; this.nextMessageId = 0; this.nextReliableMessageId = 0; this.lastReceiveActivity = 0; this.serializer = null; this.rqueue.Clear(); this.partials.Clear(); if (this.responses.IsValueCreated) { this.responses.Value.Clear(); } lock (this.pendingAck) this.pendingAck.Clear(); BufferPool.RemoveConnection(); }
public void PushBufferDestroys() { var buffer = new BufferPool (128) { AutoSizeLimit = true, AutoSizeFactor = 1 }; buffer.AddConnection(); SocketAsyncEventArgs e; buffer.TryGetBuffer (out e); buffer.RemoveConnection(); buffer.PushBuffer (e); Assert.That (() => e.SetBuffer (0, 128), Throws.TypeOf<ObjectDisposedException>()); }