bool HandleUpgrade(IAsyncResult result) { connection = ConnectionUpgradeHelper.EndInitiateUpgrade(result); if (this.channelBindingProvider != null && this.channelBindingProvider.IsChannelBindingSupportEnabled) { this.channel.channelBindingToken = this.channelBindingProvider.GetChannelBinding(this.upgradeInitiator, ChannelBindingKind.Endpoint); } this.remoteSecurity = StreamSecurityUpgradeInitiator.GetRemoteSecurity(this.upgradeInitiator); this.upgradeInitiator = null; // we're done with the initiator if (onWritePreambleEnd == null) { onWritePreambleEnd = Fx.ThunkCallback(new WaitCallback(OnWritePreambleEnd)); } AsyncCompletionResult writePreambleResult = connection.BeginWrite( ClientSingletonEncoder.PreambleEndBytes, 0, ClientSingletonEncoder.PreambleEndBytes.Length, true, timeoutHelper.RemainingTime(), onWritePreambleEnd, this); if (writePreambleResult == AsyncCompletionResult.Queued) { return(false); } connection.EndWrite(); return(ReadPreambleAck()); }
private bool HandleUpgrade(IAsyncResult result) { this.connection = ConnectionUpgradeHelper.EndInitiateUpgrade(result); if ((this.channelBindingProvider != null) && this.channelBindingProvider.IsChannelBindingSupportEnabled) { this.channel.SetChannelBinding(this.channelBindingProvider.GetChannelBinding(this.upgradeInitiator, ChannelBindingKind.Endpoint)); } this.channel.SetRemoteSecurity(this.upgradeInitiator); if (onUpgradeInitiatorClose == null) { onUpgradeInitiatorClose = Fx.ThunkCallback(new AsyncCallback(ClientFramingDuplexSessionChannel.SendPreambleAsyncResult.OnUpgradeInitiatorClose)); } IAsyncResult result2 = this.upgradeInitiator.BeginClose(this.timeoutHelper.RemainingTime(), onUpgradeInitiatorClose, this); if (!result2.CompletedSynchronously) { return(false); } return(this.HandleInitiatorClose(result2)); }
private bool HandleUpgrade(IAsyncResult result) { this.connection = ConnectionUpgradeHelper.EndInitiateUpgrade(result); if ((this.channelBindingProvider != null) && this.channelBindingProvider.IsChannelBindingSupportEnabled) { this.channel.channelBindingToken = this.channelBindingProvider.GetChannelBinding(this.upgradeInitiator, ChannelBindingKind.Endpoint); } this.remoteSecurity = StreamSecurityUpgradeInitiator.GetRemoteSecurity(this.upgradeInitiator); this.upgradeInitiator = null; if (onWritePreambleEnd == null) { onWritePreambleEnd = Fx.ThunkCallback(new AsyncCallback(StreamedFramingRequestChannel.StreamedConnectionPoolHelper.SendPreambleAsyncResult.OnWritePreambleEnd)); } IAsyncResult result2 = this.connection.BeginWrite(ClientSingletonEncoder.PreambleEndBytes, 0, ClientSingletonEncoder.PreambleEndBytes.Length, true, this.timeoutHelper.RemainingTime(), onWritePreambleEnd, this); if (!result2.CompletedSynchronously) { return(false); } this.connection.EndWrite(result2); return(this.ReadPreambleAck()); }