public ReliableRequestSessionChannel( ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters, UniqueId inputID) : base(factory, binder.RemoteAddress, binder.Via, true) { this.settings = settings; this.binder = binder; session = new ClientReliableSession(this, settings, binder, faultHelper, inputID); session.PollingCallback = PollingCallback; session.UnblockChannelCloseCallback = UnblockClose; if (this.settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) { shutdownHandle = new InterruptibleWaitObject(false); } else { replyAckConsistencyGuard = new Guard(int.MaxValue); } this.binder.Faulted += OnBinderFaulted; this.binder.OnException += OnBinderException; this.channelParameters = channelParameters; channelParameters.SetChannel(this); }
protected override void SendReply(Message reply, IReplySessionChannel channel, RequestContext item) { if (FaultHelper.AddressReply(item.RequestMessage, reply)) { item.Reply(reply); } }
protected override void OnAbort() { // Aborting base first to abort channels. Must abort higher channels before aborting lower channels. base.OnAbort(); FaultHelper.Abort(); InnerChannelFactory.Abort(); }
public ServerReliableDuplexSessionChannel(ReliableChannelListenerBase<IDuplexSessionChannel> listener, IReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(listener, listener, binder) { this.listener = listener; DuplexServerReliableSession session = new DuplexServerReliableSession(this, listener, faultHelper, inputID, outputID); base.SetSession(session); session.Open(TimeSpan.Zero); base.SetConnections(); if (PerformanceCounters.PerformanceCountersEnabled) { this.perfCounterId = this.listener.Uri.ToString().ToUpperInvariant(); } if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
protected ChannelReliableSession(ChannelBase channel, IReliableFactorySettings settings, IReliableChannelBinder binder, FaultHelper faultHelper) { this.channel = channel; this.settings = settings; this.binder = binder; this.faultHelper = faultHelper; this.inactivityTimer = new InterruptibleTimer(this.settings.InactivityTimeout, new WaitCallback(this.OnInactivityElapsed), null); this.initiationTime = ReliableMessagingConstants.UnknownInitiationTime; }
protected ChannelReliableSession(ChannelBase channel, IReliableFactorySettings settings, IReliableChannelBinder binder, FaultHelper faultHelper) { this.channel = channel; this.settings = settings; this.binder = binder; this.faultHelper = faultHelper; this.inactivityTimer = new InterruptibleTimer(this.settings.InactivityTimeout, new WaitCallback(this.OnInactivityElapsed), null); this.initiationTime = ReliableMessagingConstants.UnknownInitiationTime; }
protected internal override async Task OnCloseAsync(TimeSpan timeout) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); // Closing base first to close channels. Must close higher channels before closing lower channels. await base.OnCloseAsync(timeoutHelper.RemainingTime()); await FaultHelper.CloseAsync(timeoutHelper.RemainingTime()); await InnerChannelFactory.CloseHelperAsync(timeoutHelper.RemainingTime()); }
public ServerReliableSession( ChannelBase channel, IReliableFactorySettings listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(channel, listener, binder, faultHelper) { this.InputID = inputID; this.OutputID = outputID; }
public ReliableChannelFactory(ReliableSessionBindingElement settings, IChannelFactory <InnerChannel> innerChannelFactory, Binding binding) : base(binding) { this.acknowledgementInterval = settings.AcknowledgementInterval; this.flowControlEnabled = settings.FlowControlEnabled; this.inactivityTimeout = settings.InactivityTimeout; this.maxPendingChannels = settings.MaxPendingChannels; this.maxRetryCount = settings.MaxRetryCount; this.maxTransferWindowSize = settings.MaxTransferWindowSize; this.messageVersion = binding.MessageVersion; this.ordered = settings.Ordered; this.reliableMessagingVersion = settings.ReliableMessagingVersion; this.innerChannelFactory = innerChannelFactory; this.faultHelper = new SendFaultHelper(binding.SendTimeout, binding.CloseTimeout); }
public ReliableInputSessionChannelOverReply(ReliableChannelListenerBase<IInputSessionChannel> listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(listener, binder, faultHelper, inputID) { if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
protected ReliableOutputSessionChannel( ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory) { Settings = settings; _binder = binder; _session = new ClientReliableSession(this, settings, binder, faultHelper, null); _session.PollingCallback = PollingAsyncCallback; _session.UnblockChannelCloseCallback = UnblockClose; _binder.Faulted += OnBinderFaulted; _binder.OnException += OnBinderException; _channelParameters = channelParameters; channelParameters.SetChannel(this); }
public ReliableInputSessionChannelOverDuplex(ReliableChannelListenerBase<IInputSessionChannel> listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(listener, binder, faultHelper, inputID) { this.guard = new Guard(0x7fffffff); this.acknowledgementInterval = listener.AcknowledgementInterval; this.acknowledgementTimer = new IOThreadTimer(new Action<object>(this.OnAcknowledgementTimeoutElapsed), null, true); base.DeliveryStrategy.DequeueCallback = new Action(this.OnDeliveryStrategyItemDequeued); if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
public DuplexServerReliableSession(ServerReliableDuplexSessionChannel channel, ReliableChannelListenerBase <IDuplexSessionChannel> listener, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(channel, listener, (IServerReliableChannelBinder)channel.Binder, faultHelper, inputID, outputID) { this.channel = channel; }
public ReliableInputSessionChannelOverReply(ReliableChannelListenerBase <IInputSessionChannel> listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(listener, binder, faultHelper, inputID) { if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
protected ReliableOutputSessionChannel(ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory) { this.settings = settings; this.binder = binder; this.session = new ClientReliableSession(this, settings, binder, faultHelper, null); this.session.PollingCallback = new ClientReliableSession.PollingHandler(this.PollingCallback); this.session.UnblockChannelCloseCallback = new ChannelReliableSession.UnblockChannelCloseHandler(this.UnblockClose); this.binder.Faulted += new BinderExceptionHandler(this.OnBinderFaulted); this.binder.OnException += new BinderExceptionHandler(this.OnBinderException); this.channelParameters = channelParameters; channelParameters.SetChannel(this); }
public ReliableInputSessionChannelOverDuplex(ReliableChannelListenerBase <IInputSessionChannel> listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(listener, binder, faultHelper, inputID) { this.guard = new Guard(0x7fffffff); this.acknowledgementInterval = listener.AcknowledgementInterval; this.acknowledgementTimer = new IOThreadTimer(new Action <object>(this.OnAcknowledgementTimeoutElapsed), null, true); base.DeliveryStrategy.DequeueCallback = new Action(this.OnDeliveryStrategyItemDequeued); if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
public ReliableOutputSessionChannelOverDuplex(ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory, settings, binder, faultHelper, channelParameters) { }
public DuplexClientReliableSession(ClientReliableDuplexSessionChannel channel, IReliableFactorySettings settings, FaultHelper helper, UniqueId inputID) : base(channel, settings, (IClientReliableChannelBinder)channel.Binder, helper, inputID) { this.channel = channel; }
public ClientReliableDuplexSessionChannel(ChannelManagerBase factory, IReliableFactorySettings settings, IReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters, UniqueId inputID) : base(factory, settings, binder) { this.clientSession = new DuplexClientReliableSession(this, settings, faultHelper, inputID); this.clientSession.PollingCallback = new ClientReliableSession.PollingHandler(this.PollingCallback); base.SetSession(this.clientSession); this.channelParameters = channelParameters; channelParameters.SetChannel(this); ((IClientReliableChannelBinder)binder).ConnectionLost += new EventHandler(this.OnConnectionLost); }
public DuplexServerReliableSession(ServerReliableDuplexSessionChannel channel, ReliableChannelListenerBase<IDuplexSessionChannel> listener, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(channel, listener, (IServerReliableChannelBinder) channel.Binder, faultHelper, inputID, outputID) { this.channel = channel; }
public ServerReliableDuplexSessionChannel(ReliableChannelListenerBase <IDuplexSessionChannel> listener, IReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(listener, listener, binder) { this.listener = listener; DuplexServerReliableSession session = new DuplexServerReliableSession(this, listener, faultHelper, inputID, outputID); base.SetSession(session); session.Open(TimeSpan.Zero); base.SetConnections(); if (PerformanceCounters.PerformanceCountersEnabled) { this.perfCounterId = this.listener.Uri.ToString().ToUpperInvariant(); } if (binder.HasSession) { try { base.StartReceiving(false); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.ReliableSession.OnUnknownException(exception); } } }
public ReliableOutputSessionChannelOverDuplex(ChannelManagerBase factory, IReliableFactorySettings settings, IClientReliableChannelBinder binder, FaultHelper faultHelper, LateBoundChannelParameterCollection channelParameters) : base(factory, settings, binder, faultHelper, channelParameters) { }
public ServerReliableSession( ChannelBase channel, IReliableFactorySettings listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID, UniqueId outputID) : base(channel, listener, binder, faultHelper) { this.InputID = inputID; this.OutputID = outputID; }
public ClientReliableSession(ChannelBase channel, IReliableFactorySettings factory, IClientReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(channel, factory, binder, faultHelper) { this.binder = binder; base.InputID = inputID; this.pollingTimer = new InterruptibleTimer(this.GetPollingInterval(), new WaitCallback(this.OnPollingTimerElapsed), null); if (this.binder.Channel is IRequestChannel) { this.requestor = new RequestReliableRequestor(); } else if (this.binder.Channel is IDuplexChannel) { SendReceiveReliableRequestor requestor = new SendReceiveReliableRequestor { TimeoutIsSafe = !this.ChannelSupportsOneCreateSequenceAttempt() }; this.requestor = requestor; } MessageVersion messageVersion = base.Settings.MessageVersion; ReliableMessagingVersion reliableMessagingVersion = base.Settings.ReliableMessagingVersion; this.requestor.MessageVersion = messageVersion; this.requestor.Binder = this.binder; this.requestor.IsCreateSequence = true; this.requestor.TimeoutString1Index = "TimeoutOnOpen"; this.requestor.MessageAction = WsrmIndex.GetCreateSequenceActionHeader(messageVersion.Addressing, reliableMessagingVersion); if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (this.binder.GetInnerSession() is ISecureConversationSession)) { this.requestor.MessageHeader = new WsrmUsesSequenceSTRHeader(); } this.requestor.MessageBody = new CreateSequence(base.Settings.MessageVersion.Addressing, reliableMessagingVersion, base.Settings.Ordered, this.binder, base.InputID); this.requestor.SetRequestResponsePattern(); }
public ClientReliableSession(ChannelBase channel, IReliableFactorySettings factory, IClientReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(channel, factory, binder, faultHelper) { this.binder = binder; this.InputID = inputID; this.pollingTimer = new InterruptibleTimer(this.GetPollingInterval(), this.OnPollingTimerElapsed, null); if (this.binder.Channel is IRequestChannel) { this.requestor = new RequestReliableRequestor(); } else if (this.binder.Channel is IDuplexChannel) { SendReceiveReliableRequestor sendReceiveRequestor = new SendReceiveReliableRequestor(); sendReceiveRequestor.TimeoutIsSafe = !this.ChannelSupportsOneCreateSequenceAttempt(); this.requestor = sendReceiveRequestor; } else { Fx.Assert("This channel type is not supported"); } MessageVersion messageVersion = this.Settings.MessageVersion; ReliableMessagingVersion reliableMessagingVersion = this.Settings.ReliableMessagingVersion; this.requestor.MessageVersion = messageVersion; this.requestor.Binder = this.binder; this.requestor.IsCreateSequence = true; this.requestor.TimeoutString1Index = SR.TimeoutOnOpen; this.requestor.MessageAction = WsrmIndex.GetCreateSequenceActionHeader(messageVersion.Addressing, reliableMessagingVersion); if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (this.binder.GetInnerSession() is ISecureConversationSession)) { this.requestor.MessageHeader = new WsrmUsesSequenceSTRHeader(); } this.requestor.MessageBody = new CreateSequence(this.Settings.MessageVersion.Addressing, reliableMessagingVersion, this.Settings.Ordered, this.binder, this.InputID); this.requestor.SetRequestResponsePattern(); }
protected ReliableInputSessionChannel(ReliableChannelListenerBase <IInputSessionChannel> listener, IServerReliableChannelBinder binder, FaultHelper faultHelper, UniqueId inputID) : base(listener, binder.LocalAddress) { this.binder = binder; this.listener = listener; this.connection = new ReliableInputConnection(); this.connection.ReliableMessagingVersion = listener.ReliableMessagingVersion; this.session = new ServerReliableSession(this, listener, binder, faultHelper, inputID, null); this.session.UnblockChannelCloseCallback = new ChannelReliableSession.UnblockChannelCloseHandler(this.UnblockClose); if (listener.Ordered) { this.deliveryStrategy = new OrderedDeliveryStrategy <Message>(this, listener.MaxTransferWindowSize, false); } else { this.deliveryStrategy = new UnorderedDeliveryStrategy <Message>(this, listener.MaxTransferWindowSize); } this.binder.Faulted += new BinderExceptionHandler(this.OnBinderFaulted); this.binder.OnException += new BinderExceptionHandler(this.OnBinderException); this.session.Open(TimeSpan.Zero); if (PerformanceCounters.PerformanceCountersEnabled) { this.perfCounterId = this.listener.Uri.ToString().ToUpperInvariant(); } }