protected TReliableChannel ProcessCreateSequence(WsrmMessageInfo info, TInnerChannel channel, out bool dispatch, out bool newChannel) { EndpointAddress address; dispatch = false; newChannel = false; CreateSequenceInfo createSequenceInfo = info.CreateSequenceInfo; if (!WsrmUtilities.ValidateCreateSequence <TChannel>(info, this, channel, out address)) { return(default(TReliableChannel)); } lock (base.ThisLock) { TReliableChannel local = default(TReliableChannel); if (((createSequenceInfo.OfferIdentifier == null) || !this.Duplex) || !this.channelsByOutput.TryGetValue(createSequenceInfo.OfferIdentifier, out local)) { if (!base.IsAccepting) { info.FaultReply = WsrmUtilities.CreateEndpointNotFoundFault(base.MessageVersion, System.ServiceModel.SR.GetString("RMEndpointNotFoundReason", new object[] { this.Uri })); return(default(TReliableChannel)); } if (this.inputQueueChannelAcceptor.PendingCount >= base.MaxPendingChannels) { info.FaultReply = WsrmUtilities.CreateCSRefusedServerTooBusyFault(base.MessageVersion, base.ReliableMessagingVersion, System.ServiceModel.SR.GetString("ServerTooBusy", new object[] { this.Uri })); return(default(TReliableChannel)); } UniqueId id = WsrmUtilities.NextSequenceId(); local = this.CreateChannel(id, createSequenceInfo, this.CreateBinder(channel, address, createSequenceInfo.ReplyTo)); this.channelsByInput.Add(id, local); if (this.Duplex) { this.channelsByOutput.Add(createSequenceInfo.OfferIdentifier, local); } dispatch = this.EnqueueWithoutDispatch((TChannel)local); newChannel = true; } return(local); } }
protected override TChannel OnCreateChannel(EndpointAddress address, Uri via) { LateBoundChannelParameterCollection channelParameters = new LateBoundChannelParameterCollection(); IClientReliableChannelBinder binder = ClientReliableChannelBinder <InnerChannel> .CreateBinder(address, via, this.InnerChannelFactory, MaskingMode.All, TolerateFaultsMode.IfNotSecuritySession, channelParameters, this.DefaultCloseTimeout, this.DefaultSendTimeout); if (typeof(TChannel) == typeof(IOutputSessionChannel)) { if (!(typeof(InnerChannel) == typeof(IDuplexChannel)) && !(typeof(InnerChannel) == typeof(IDuplexSessionChannel))) { return((TChannel) new ReliableOutputSessionChannelOverRequest(this, this, binder, this.faultHelper, channelParameters)); } return((TChannel) new ReliableOutputSessionChannelOverDuplex(this, this, binder, this.faultHelper, channelParameters)); } if (typeof(TChannel) == typeof(IDuplexSessionChannel)) { return((TChannel) new ClientReliableDuplexSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId())); } return((TChannel) new ReliableRequestSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId())); }