Exemple #1
0
 public void Initialize(InternalBigEndianReader reader,
                        AmqpPrimitivesReader amqpReader, IFrameProcessor frameProcessor)
 {
     _reader         = reader;
     _amqpReader     = amqpReader;
     _frameProcessor = frameProcessor;
 }
        private void WireStreams(Socket newSocket, Action notifyWhenClosed)
        {
            if (_socket != null)             // reset
            {
                _socketIsClosed = 0;

                // TODO: replace cancellation token in ringbuffers

                // _inputBuffer.Reset();
                // _outputBuffer.Reset();
            }

            _socket           = newSocket;
            _notifyWhenClosed = notifyWhenClosed;

            // WriteLoop
            _socketConsumer = new SocketConsumer(_socket, _outputBuffer, _token, _index);
            _socketConsumer.OnNotifyClosed += OnSocketClosed;

            // ReadLoop
            _socketProducer = new SocketProducer(_socket, _inputBuffer, _token, _index);
            _socketProducer.OnNotifyClosed += OnSocketClosed;

            Writer = new InternalBigEndianWriter(_outputRingBufferStream);
            Reader = new InternalBigEndianReader(_inputRingBufferStream);
//
//			_socketConsumer.Start();
        }
        public FrameReader(InternalBigEndianReader reader, 
						   AmqpPrimitivesReader amqpReader,
						   IFrameProcessor frameProcessor)
        {
            _reader = reader;
            _amqpReader = amqpReader;
            _frameProcessor = frameProcessor;
        }
Exemple #4
0
        internal void WireStreams(CancellationToken cancellationToken, Action notifyWhenClosed)
        {
            _inputBuffer.Restart();

            // _socket = newSocket;
            _notifyWhenClosed = notifyWhenClosed;

            // WriteLoop
            _socketConsumer = new SocketStreamWriterAdapter(_socket);
            _socketConsumer.OnNotifyClosed += OnSocketClosed;

            // ReadLoop
            _socketProducer = new SocketProducer(_socket, _inputBuffer, cancellationToken, _index);
            _socketProducer.OnNotifyClosed += OnSocketClosed;

            Writer = new InternalBigEndianWriter(_socketConsumer);
            Reader = new InternalBigEndianReader(_inputRingBufferStream);
        }
        public SocketRingBuffers(Socket socket, CancellationToken cancellationToken, Action notifyWhenClosed, Action flushWrite)
        {
            _notifyWhenClosed = notifyWhenClosed;

            _inputBuffer = new ByteRingBuffer(cancellationToken);
            _outputBuffer = new ByteRingBuffer(cancellationToken);

            _inputRingBufferStream = new RingBufferStreamAdapter(_inputBuffer);
            _outputRingBufferStream = new RingBufferStreamAdapter(_outputBuffer);

            // WriteLoop
            _socketConsumer = new SocketConsumer(socket, _outputBuffer, cancellationToken, flushWrite);
            _socketConsumer.OnNotifyClosed += OnSocketClosed;

            // ReadLoop
            _socketProducer = new SocketProducer(socket, _inputBuffer, cancellationToken);
            _socketProducer.OnNotifyClosed += OnSocketClosed;

            Writer = new InternalBigEndianWriter(_outputRingBufferStream);
            Reader = new InternalBigEndianReader(_inputRingBufferStream);
        }
Exemple #6
0
        public void WireStreams(CancellationToken cancellationToken, Action notifyWhenClosed)
        {
            _inputBuffer.SetSocket(_socket, OnSocketClosed);

            _inputBuffer.ReenableBuffers();

            _notifyWhenClosed = notifyWhenClosed;

            // WriteLoop
            _socketConsumer = new SocketStreamWriterAdapter(_socket)
            {
                OnNotifyClosed = OnSocketClosed
            };

            // ReadLoop
            // _socketProducer = new SocketProducer(_socket, _inputBuffer, cancellationToken, _index);
            // _socketProducer.OnNotifyClosed += OnSocketClosed;
            Writer = new InternalBigEndianWriter(_socketConsumer.Write);
            Reader = new InternalBigEndianReader(_inputRingBufferStream);
            // Reader = new publicBigEndianReader(new SocketStreamReaderAdapter(_socket));
        }
        public SocketRingBuffers(Socket socket, CancellationToken cancellationToken, Action notifyWhenClosed, Action flushWrite)
        {
            _notifyWhenClosed = notifyWhenClosed;

            _inputBuffer  = new ByteRingBuffer(cancellationToken);
            _outputBuffer = new ByteRingBuffer(cancellationToken);

            _inputRingBufferStream  = new RingBufferStreamAdapter(_inputBuffer);
            _outputRingBufferStream = new RingBufferStreamAdapter(_outputBuffer);

            // WriteLoop
            _socketConsumer = new SocketConsumer(socket, _outputBuffer, cancellationToken, flushWrite);
            _socketConsumer.OnNotifyClosed += OnSocketClosed;

            // ReadLoop
            _socketProducer = new SocketProducer(socket, _inputBuffer, cancellationToken);
            _socketProducer.OnNotifyClosed += OnSocketClosed;

            Writer = new InternalBigEndianWriter(_outputRingBufferStream);
            Reader = new InternalBigEndianReader(_inputRingBufferStream);
        }
 public AmqpPrimitivesReader(InternalBigEndianReader reader)
 {
     _reader = reader;
 }
		private void WireStreams(Socket newSocket, Action notifyWhenClosed)
		{
			if (_socket != null) // reset
			{
				_socketIsClosed = 0; 

				// TODO: replace cancellation token in ringbuffers

				// _inputBuffer.Reset();
				// _outputBuffer.Reset();
			}

			_socket = newSocket;
			_notifyWhenClosed = notifyWhenClosed;

			// WriteLoop
			_socketConsumer = new SocketConsumer(_socket, _outputBuffer, _token, _index);
			_socketConsumer.OnNotifyClosed += OnSocketClosed;

			// ReadLoop
			_socketProducer = new SocketProducer(_socket, _inputBuffer, _token, _index);
			_socketProducer.OnNotifyClosed += OnSocketClosed;

			Writer = new InternalBigEndianWriter(_outputRingBufferStream);
			Reader = new InternalBigEndianReader(_inputRingBufferStream);
//
//			_socketConsumer.Start();
		}
 public void Initialize(InternalBigEndianReader reader)
 {
     _reader = reader;
 }
 public AmqpPrimitivesReader(InternalBigEndianReader reader)
 {
     _reader = reader;
 }