Exemple #1
0
 public void Initialize(InternalBigEndianReader reader,
                        AmqpPrimitivesReader amqpReader, IFrameProcessor frameProcessor)
 {
     _reader         = reader;
     _amqpReader     = amqpReader;
     _frameProcessor = frameProcessor;
 }
        public FrameReader(InternalBigEndianReader reader, 
						   AmqpPrimitivesReader amqpReader,
						   IFrameProcessor frameProcessor)
        {
            _reader = reader;
            _amqpReader = amqpReader;
            _frameProcessor = frameProcessor;
        }
		internal async Task InternalDoConnectSocket(string hostname, int port)
		{
			var index = Interlocked.Increment(ref _counter);

			await _socketHolder.Connect(hostname, port, OnSocketClosed, index);

			_amqpWriter = new AmqpPrimitivesWriter(_socketHolder.Writer, null, null);
			_amqpReader = new AmqpPrimitivesReader(_socketHolder.Reader);

			_frameReader = new FrameReader(_socketHolder.Reader, _amqpReader, this);

			var t1 = new Thread(WriteFramesLoop) { IsBackground = true, Name = "WriteFramesLoop_" + index };
			t1.Start();
			var t2 = new Thread(ReadFramesLoop) { IsBackground = true, Name = "ReadFramesLoop_" + index };
			t2.Start();
		}