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(); }
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]); }
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 }; }
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); }
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); }
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]); }