public bool Receive(ReceiverAsyncEventArgs args) { _curEventArgs = args; args.Error = null; args.Response = null; _multiBulkPartsLeft = 0; _multiBulkParts = null; _redisResponse = null; return ReadResponseFromStream(false, _socketArgs); }
public RedisReceiverTests() { _bufferFromPool = new byte[1024]; _args = new ReceiverAsyncEventArgs(); _asyncSocket = new Mock <IAsyncSocket>(); _asyncSocket.Setup(s => s.Receive(It.IsAny <AsyncSocketEventArgs>())) .Callback((AsyncSocketEventArgs a) => { a.DataLength = _dataBuffer.Length; Array.Copy(_dataBuffer, a.BufferToReceive, _dataBuffer.Length); }); _buffersPool = new Mock <IBuffersPool>(); _buffersPool.Setup(b => b.TryGet(out _bufferFromPool, It.IsAny <Action <byte[]> >())) .Returns(true); }
private void ItemReceiveProcessDone(bool async, ReceiverAsyncEventArgs args) { _pipelineException = args.Error; if (_pipelineException != null) { _currentReceiveItem.CallBack(_pipelineException, null); } else { _currentReceiveItem.CallBack(null, args.Response); } if (async) { RunReceiveProcess(); } }
private void ItemReceiveProcessDone(ReceiverAsyncEventArgs args) { ItemReceiveProcessDone(true, args); }
public void Setup() { _bufferFromPool = new byte[1024]; _args = new ReceiverAsyncEventArgs(); _asyncSocket= new Mock<IAsyncSocket>(); _asyncSocket.Setup(s => s.Receive(It.IsAny<AsyncSocketEventArgs>())) .Callback((AsyncSocketEventArgs a) => { a.DataLength = _dataBuffer.Length; Array.Copy(_dataBuffer,a.BufferToReceive,_dataBuffer.Length); }); _buffersPool = new Mock<IBuffersPool>(); _buffersPool.Setup(b => b.TryGet(out _bufferFromPool, It.IsAny<Action<byte[]>>())) .Returns(true); }
private void ItemReceiveProcessDone(bool async, ReceiverAsyncEventArgs args) { if (args.HasError) _pipelineException = args.Error; if (_pipelineException != null) _currentReceiveItem.CallBack(_pipelineException, null); else _currentReceiveItem.CallBack(null, args.Response); if (async) RunReceiveProcess(); }
private void ItemReceiveProcessDone(ReceiverAsyncEventArgs args) { ItemReceiveProcessDone(true,args); }