protected override void OnAbort() { StreamUpgradeProvider localUpgrade = GetUpgrade(); if (localUpgrade != null) { localUpgrade.Abort(); } base.OnAbort(); }
protected ConnectionOrientedTransportChannelListener(ConnectionOrientedTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, bindingElement.HostNameComparisonMode) { if (bindingElement.TransferMode == TransferMode.Buffered) { if (bindingElement.MaxReceivedMessageSize > int.MaxValue) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", SR.MaxReceivedMessageSizeMustBeInIntegerRange)); } if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.MaxBufferSizeMustMatchMaxReceivedMessageSize); } } else { if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.MaxBufferSizeMustNotExceedMaxReceivedMessageSize); } } connectionBufferSize = bindingElement.ConnectionBufferSize; exposeConnectionProperty = false; //bindingElement.ExposeConnectionProperty; InheritBaseAddressSettings = false; //bindingElement.InheritBaseAddressSettings; channelInitializationTimeout = bindingElement.ChannelInitializationTimeout; maxBufferSize = bindingElement.MaxBufferSize; maxPendingConnections = bindingElement.MaxPendingConnections; maxOutputDelay = bindingElement.MaxOutputDelay; maxPendingAccepts = bindingElement.MaxPendingAccepts; transferMode = bindingElement.TransferMode; Collection <StreamUpgradeBindingElement> upgradeBindingElements = context.BindingParameters.FindAll <StreamUpgradeBindingElement>(); if (upgradeBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.MultipleStreamUpgradeProvidersInParameters)); } else if ((upgradeBindingElements.Count == 1) && SupportsUpgrade(upgradeBindingElements[0])) { upgrade = upgradeBindingElements[0].BuildServerStreamUpgradeProvider(context); ownUpgrade = true; context.BindingParameters.Remove <StreamUpgradeBindingElement>(); securityCapabilities = upgradeBindingElements[0].GetProperty <ISecurityCapabilities>(context); } }
protected override async Task OnOpenAsync(CancellationToken token) { await base.OnOpenAsync(token); StreamUpgradeProvider localUpgrade = Upgrade; if (localUpgrade != null) { await localUpgrade.OpenAsync(token); } }
public bool TransferUpgrade(StreamUpgradeProvider upgrade) { lock (ThisLock) { if (State != CommunicationState.Opened) { return(false); } this.upgrade = upgrade; return(true); } }
public static FramingConnectionDuplexSession CreateSession(FramingDuplexSessionChannel channel, StreamUpgradeProvider upgrade) { StreamSecurityUpgradeProvider security = upgrade as StreamSecurityUpgradeProvider; if (security == null) { return(new FramingConnectionDuplexSession(channel)); } else { return(new SecureConnectionDuplexSession(channel)); } }
StreamUpgradeProvider GetUpgrade() { StreamUpgradeProvider result = null; lock (ThisLock) { if (ownUpgrade) { result = upgrade; ownUpgrade = false; } } return(result); }
protected override async Task OnCloseAsync(CancellationToken token) { StreamUpgradeProvider localUpgrade = GetUpgrade(); if (localUpgrade != null) { await localUpgrade.CloseAsync(token); await base.OnCloseAsync(token); } else { await base.OnCloseAsync(token); } }
public ServerFramingDuplexSessionChannel(ConnectionOrientedTransportChannelListener channelListener, ServerSessionPreambleConnectionReader preambleReader, EndpointAddress localAddress, bool exposeConnectionProperty, ConnectionDemuxer connectionDemuxer) : base(channelListener, localAddress, preambleReader.Via, exposeConnectionProperty) { this.channelListener = channelListener; this.connectionDemuxer = connectionDemuxer; Connection = preambleReader.Connection; decoder = preambleReader.Decoder; connectionBuffer = preambleReader.connectionBuffer; offset = preambleReader.BufferOffset; size = preambleReader.BufferSize; rawConnection = preambleReader.RawConnection; StreamUpgradeProvider upgrade = channelListener.Upgrade; if (upgrade != null) { channelBindingProvider = upgrade.GetProperty <IStreamUpgradeChannelBindingProvider>(); upgradeAcceptor = upgrade.CreateUpgradeAcceptor(); } }
public ConnectionOrientedTransportReplyChannelAcceptor(ConnectionOrientedTransportChannelListener listener) : base(listener) { upgrade = listener.GetUpgrade(); }