bool HandleWritePreamble() { connection.EndWrite(); if (channel.upgrade == null) { return(ReadPreambleAck()); } else { this.channelBindingProvider = channel.upgrade.GetProperty <IStreamUpgradeChannelBindingProvider>(); this.upgradeInitiator = channel.upgrade.CreateUpgradeInitiator(channel.RemoteAddress, channel.Via); if (onUpgrade == null) { onUpgrade = Fx.ThunkCallback(new AsyncCallback(OnUpgrade)); } IAsyncResult initiateUpgradeResult = ConnectionUpgradeHelper.BeginInitiateUpgrade(channel.settings, channel.RemoteAddress, connection, decoder, this.upgradeInitiator, channel.messageEncoder.ContentType, null, this.timeoutHelper, onUpgrade, this); if (!initiateUpgradeResult.CompletedSynchronously) { return(false); } return(HandleUpgrade(initiateUpgradeResult)); } }
private bool HandleInitiatorOpen(IAsyncResult result) { this.upgradeInitiator.EndOpen(result); if (onUpgrade == null) { onUpgrade = Fx.ThunkCallback(new AsyncCallback(ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgrade)); } IAsyncResult result2 = ConnectionUpgradeHelper.BeginInitiateUpgrade(this.channel, this.channel.RemoteAddress, this.connection, this.channel.decoder, this.upgradeInitiator, this.channel.MessageEncoder.ContentType, this.identityToImpersonate, this.timeoutHelper, onUpgrade, this); if (!result2.CompletedSynchronously) { return(false); } return(this.HandleUpgrade(result2)); }
private bool HandleWritePreamble(IAsyncResult result) { this.connection.EndWrite(result); if (this.channel.upgrade == null) { return(this.ReadPreambleAck()); } this.channelBindingProvider = this.channel.upgrade.GetProperty <IStreamUpgradeChannelBindingProvider>(); this.upgradeInitiator = this.channel.upgrade.CreateUpgradeInitiator(this.channel.RemoteAddress, this.channel.Via); if (onUpgrade == null) { onUpgrade = Fx.ThunkCallback(new AsyncCallback(StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult.OnUpgrade)); } IAsyncResult result2 = ConnectionUpgradeHelper.BeginInitiateUpgrade(this.channel.settings, this.channel.RemoteAddress, this.connection, this.decoder, this.upgradeInitiator, this.channel.messageEncoder.ContentType, null, this.timeoutHelper, onUpgrade, this); if (!result2.CompletedSynchronously) { return(false); } return(this.HandleUpgrade(result2)); }