コード例 #1
0
        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);
            }
        }
コード例 #2
0
        protected override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            ConnectionOrientedTransportBindingElement connection = b as ConnectionOrientedTransportBindingElement;

            if (connection == null)
            {
                return(false);
            }

            if (connectionBufferSize != connection.connectionBufferSize)
            {
                return(false);
            }
            if (hostNameComparisonMode != connection.hostNameComparisonMode)
            {
                return(false);
            }
            if (inheritBaseAddressSettings != connection.inheritBaseAddressSettings)
            {
                return(false);
            }
            if (channelInitializationTimeout != connection.channelInitializationTimeout)
            {
                return(false);
            }
            if (maxBufferSize != connection.maxBufferSize)
            {
                return(false);
            }
            if (maxPendingConnections != connection.maxPendingConnections)
            {
                return(false);
            }
            if (maxOutputDelay != connection.maxOutputDelay)
            {
                return(false);
            }
            if (maxPendingAccepts != connection.maxPendingAccepts)
            {
                return(false);
            }
            if (transferMode != connection.transferMode)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
 internal ConnectionOrientedTransportBindingElement(ConnectionOrientedTransportBindingElement elementToBeCloned)
     : base(elementToBeCloned)
 {
     connectionBufferSize         = elementToBeCloned.connectionBufferSize;
     exposeConnectionProperty     = elementToBeCloned.exposeConnectionProperty;
     hostNameComparisonMode       = elementToBeCloned.hostNameComparisonMode;
     inheritBaseAddressSettings   = elementToBeCloned.InheritBaseAddressSettings;
     channelInitializationTimeout = elementToBeCloned.ChannelInitializationTimeout;
     maxBufferSize              = elementToBeCloned.maxBufferSize;
     maxBufferSizeInitialized   = elementToBeCloned.maxBufferSizeInitialized;
     maxPendingConnections      = elementToBeCloned.maxPendingConnections;
     maxOutputDelay             = elementToBeCloned.maxOutputDelay;
     maxPendingAccepts          = elementToBeCloned.maxPendingAccepts;
     transferMode               = elementToBeCloned.transferMode;
     isMaxPendingConnectionsSet = elementToBeCloned.isMaxPendingConnectionsSet;
     isMaxPendingAcceptsSet     = elementToBeCloned.isMaxPendingAcceptsSet;
 }
コード例 #4
0
 internal ConnectionOrientedTransportBindingElement(ConnectionOrientedTransportBindingElement elementToBeCloned)
     : base(elementToBeCloned)
 {
     _connectionBufferSize         = elementToBeCloned._connectionBufferSize;
     _exposeConnectionProperty     = elementToBeCloned._exposeConnectionProperty;
     _hostNameComparisonMode       = elementToBeCloned._hostNameComparisonMode;
     InheritBaseAddressSettings    = elementToBeCloned.InheritBaseAddressSettings;
     _channelInitializationTimeout = elementToBeCloned.ChannelInitializationTimeout;
     _maxBufferSize             = elementToBeCloned._maxBufferSize;
     _maxBufferSizeInitialized  = elementToBeCloned._maxBufferSizeInitialized;
     _maxPendingConnections     = elementToBeCloned._maxPendingConnections;
     _maxOutputDelay            = elementToBeCloned._maxOutputDelay;
     _maxPendingAccepts         = elementToBeCloned._maxPendingAccepts;
     _transferMode              = elementToBeCloned._transferMode;
     IsMaxPendingConnectionsSet = elementToBeCloned.IsMaxPendingConnectionsSet;
     IsMaxPendingAcceptsSet     = elementToBeCloned.IsMaxPendingAcceptsSet;
 }