예제 #1
0
        public bool Receive(ReceiverAsyncEventArgs args)
        {
            _curEventArgs = args;
            args.Error = null;
            args.Response = null;

            _multiBulkPartsLeft = 0;
            _multiBulkParts = null;
            _redisResponse = null;

            return ReadResponseFromStream(false, _socketArgs);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
 private void ItemReceiveProcessDone(ReceiverAsyncEventArgs args)
 {
     ItemReceiveProcessDone(true, args);
 }
예제 #5
0
        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);
        }
예제 #6
0
        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();
        }
예제 #7
0
 private void ItemReceiveProcessDone(ReceiverAsyncEventArgs args)
 {
     ItemReceiveProcessDone(true,args);
 }