Example #1
0
            int state;  //0: idle, 1: busy, 2: closed

            public AsyncWriter(AsyncIO parent, int bufferSize)
            {
                this.parent              = parent;
                this.transport           = parent.transport;
                this.writeAsyncEventArgs = new TransportAsyncCallbackArgs();
                this.writeAsyncEventArgs.CompletedCallback = this.WriteCompleteCallback;
                this.writeBuffer = ByteBuffer.Wrap(new byte[bufferSize]);
                this.syncRoot    = new object();
            }
Example #2
0
            public AsyncReader(
                AsyncIO parent,
                int readBufferSize,
                Action <ByteBuffer> receiveBufferHandler)
            {
                this.parent = parent;
                this.receiveBufferHandler = receiveBufferHandler;

                this.readAsyncEventArgs = new TransportAsyncCallbackArgs();
                this.readAsyncEventArgs.CompletedCallback = this.OnBufferReadComplete;
                this.readBuffer = ByteBuffer.Wrap(new byte[readBufferSize]);
            }
Example #3
0
 public AsyncReader(AsyncIO parent, int maxFrameSize, bool readProtocolHeader)
 {
     this.asyncIo            = parent;
     this.maxFrameSize       = maxFrameSize;
     this.readProtocolHeader = readProtocolHeader;
     this.frameSizeBuffer    = AsyncIO.AsyncReader.FrameSizeSegmentPool.TakeBuffer(4);
     this.readAsyncEventArgs = new TransportAsyncCallbackArgs()
     {
         CompletedCallback = AsyncIO.AsyncReader.onReadBufferComplete,
         UserToken         = this
     };
 }
Example #4
0
        public AmqpConnectionBase(TransportBase transport, AmqpConnectionSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this.settings = settings;

            Fx.Assert(transport != null, "transport must not be null.");
            this.principal = transport.Principal;
            this.asyncIO   = new AsyncIO(
                AmqpConstants.AsyncBufferSize,
                transport,
                new Action <ByteBuffer>(this.OnReceiveBuffer),
                this.OnAsyncIoFaulted);
            this.bufferHandler = new SerializedWorker <ByteBuffer>(this.OnReceiveFrameBuffer, null, false);
        }
Example #5
0
        public AmqpConnectionBase(TransportBase transport, AmqpConnectionSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            this.settings = settings;

            Fx.Assert(transport != null, "transport must not be null.");
            this.principal = transport.Principal;
            this.asyncIO = new AsyncIO(
                AmqpConstants.AsyncBufferSize,
                transport,
                new Action<ByteBuffer>(this.OnReceiveBuffer),
                this.OnAsyncIoFaulted);
            this.bufferHandler = new SerializedWorker<ByteBuffer>(this.OnReceiveFrameBuffer, null, false);
        }
Example #6
0
            public AsyncReader(
                AsyncIO parent,
                int readBufferSize,
                Action<ByteBuffer> receiveBufferHandler)
            {
                this.parent = parent;
                this.receiveBufferHandler = receiveBufferHandler;

                this.readAsyncEventArgs = new TransportAsyncCallbackArgs();
                this.readAsyncEventArgs.CompletedCallback = this.OnBufferReadComplete;
                this.readBuffer = ByteBuffer.Wrap(new byte[readBufferSize]);
            }
Example #7
0
            int state;  //0: idle, 1: busy, 2: closed

            public AsyncWriter(AsyncIO parent, int bufferSize)
            {
                this.parent = parent;
                this.transport = parent.transport;
                this.writeAsyncEventArgs = new TransportAsyncCallbackArgs();
                this.writeAsyncEventArgs.CompletedCallback = this.WriteCompleteCallback;
                this.writeBuffer = ByteBuffer.Wrap(new byte[bufferSize]);
                this.syncRoot = new object();
            }