Exemplo n.º 1
0
 public void Enqueue(SendPacketsElement buffer)
 {
     if (_bytesLeft <= 0)
         throw new InvalidOperationException(
             "Too much data, check the BytesLeftToEnqueue property before enqueing too much.");
     _bytesLeft -= buffer.Count;
     _buffers.Add(buffer);
 }
		public void TransparentDispose ()
		{
			var buffer = new byte[5];
			var elements = new SendPacketsElement[2];
			var utoken = new object();

			var saea = new SocketAsyncEventArgs();
			saea.SetBuffer(buffer, 0, 3);
			saea.SendPacketsElements = elements;
			saea.UserToken = utoken;

			saea.Dispose();

			Assert.AreEqual (buffer, saea.Buffer);
			Assert.AreEqual (elements, saea.SendPacketsElements);
			Assert.AreEqual (utoken, saea.UserToken);
		}
Exemplo n.º 3
0
 public SendPacketsElement[] GetElements()
 {
     var el = new SendPacketsElement[_sliceCount];
     for (var i = 0; i < _sliceCount; i++)
     {
         var bufferSlice = _queue[i];
         el[i] = new SendPacketsElement(bufferSlice.Buffer, bufferSlice.Offset, bufferSlice.Count2);
     }
     return el;
 }