public ConnectAsyncResult(AmqpTransportInitiator initiator, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { TransportAsyncCallbackArgs transportAsyncCallbackArg = new TransportAsyncCallbackArgs() { CompletedCallback = AmqpTransportInitiator.ConnectAsyncResult.onConnect, UserToken = this }; if (!initiator.ConnectAsync(timeout, transportAsyncCallbackArg)) { AmqpTransportInitiator.ConnectAsyncResult.OnConnect(transportAsyncCallbackArg); } }
private void HandleTransportOpened(IAsyncResult result) { TransportAsyncCallbackArgs asyncState = (TransportAsyncCallbackArgs)result.AsyncState; asyncState.Transport.EndOpen(result); AmqpTransportInitiator amqpTransportInitiator = this; amqpTransportInitiator.providerIndex = amqpTransportInitiator.providerIndex + 1; if (this.providerIndex == this.settings.TransportProviders.Count || this.settings.TransportProviders[this.providerIndex].ProtocolId == ProtocolId.Amqp) { this.writer = null; this.reader = null; this.providerIndex = 0; this.Complete(asyncState); return; } this.writer = new AsyncIO.AsyncBufferWriter(asyncState.Transport); this.reader = new AsyncIO.AsyncBufferReader(asyncState.Transport); this.WriteSecurityHeader(asyncState); }