OneWayBindingElement(OneWayBindingElement elementToBeCloned)
     : base(elementToBeCloned)
 {
     this.channelPoolSettings = elementToBeCloned.ChannelPoolSettings.Clone();
     this.packetRoutable      = elementToBeCloned.PacketRoutable;
     this.maxAcceptedChannels = elementToBeCloned.maxAcceptedChannels;
 }
 internal void ApplyConfiguration(ChannelPoolSettings settings)
 {
     if (settings == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings");
     }
     settings.IdleTimeout = this.IdleTimeout;
     settings.LeaseTimeout = this.LeaseTimeout;
     settings.MaxOutboundChannelsPerEndpoint = this.MaxOutboundChannelsPerEndpoint;
 }
 internal void InitializeFrom(ChannelPoolSettings settings)
 {
     if (settings == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings");
     }
     this.IdleTimeout = settings.IdleTimeout;
     this.LeaseTimeout = settings.LeaseTimeout;
     this.MaxOutboundChannelsPerEndpoint = settings.MaxOutboundChannelsPerEndpoint;
 }
        internal void InitializeFrom(ChannelPoolSettings settings)
        {
            if (null == settings)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings");
            }

            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.IdleTimeout, settings.IdleTimeout);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.LeaseTimeout, settings.LeaseTimeout);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxOutboundChannelsPerEndpoint, settings.MaxOutboundChannelsPerEndpoint);
        }
        public DuplexSessionOneWayChannelFactory(OneWayBindingElement bindingElement, BindingContext context) : base(context.Binding, context.BuildInnerChannelFactory <IDuplexSessionChannel>())
        {
            this.packetRoutable = bindingElement.PacketRoutable;
            ISecurityCapabilities property = base.InnerChannelFactory.GetProperty <ISecurityCapabilities>();

            if ((property != null) && property.SupportsClientAuthentication)
            {
                this.channelPoolSettings = bindingElement.ChannelPoolSettings.Clone();
            }
            else
            {
                this.channelPool = new ChannelPool <IDuplexSessionChannel>(bindingElement.ChannelPoolSettings);
            }
        }
        public ChannelManagerService(ChannelPoolSettings settings, IList<ServiceEndpoint> endpoints)
        {
            if (settings == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("settings");
            }

            if (endpoints == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("endpoints");
            }

            this.settings = settings;
            this.codeEndpoints = endpoints;
        }
Beispiel #7
0
        public DuplexSessionOneWayChannelFactory(OneWayBindingElement bindingElement, BindingContext context)
            : base(context.Binding, context.BuildInnerChannelFactory <IDuplexSessionChannel>())
        {
            this.packetRoutable = bindingElement.PacketRoutable;

            ISecurityCapabilities innerSecurityCapabilities = this.InnerChannelFactory.GetProperty <ISecurityCapabilities>();

            // can't pool across outer channels if the inner channels support client auth
            if (innerSecurityCapabilities != null && innerSecurityCapabilities.SupportsClientAuthentication)
            {
                this.channelPoolSettings = bindingElement.ChannelPoolSettings.Clone();
            }
            else
            {
                this.channelPool = new ChannelPool <IDuplexSessionChannel>(bindingElement.ChannelPoolSettings);
            }
        }
Beispiel #8
0
 internal bool IsMatch(ChannelPoolSettings channelPoolSettings)
 {
     if (channelPoolSettings == null)
     {
         return false;
     }
     if (this.idleTimeout != channelPoolSettings.idleTimeout)
     {
         return false;
     }
     if (this.leaseTimeout != channelPoolSettings.leaseTimeout)
     {
         return false;
     }
     if (this.maxOutboundChannelsPerEndpoint != channelPoolSettings.maxOutboundChannelsPerEndpoint)
     {
         return false;
     }
     return true;
 }
Beispiel #9
0
        internal bool IsMatch(ChannelPoolSettings channelPoolSettings)
        {
            if (channelPoolSettings == null)
            {
                return(false);
            }

            if (_idleTimeout != channelPoolSettings._idleTimeout)
            {
                return(false);
            }

            if (_leaseTimeout != channelPoolSettings._leaseTimeout)
            {
                return(false);
            }

            if (_maxOutboundChannelsPerEndpoint != channelPoolSettings._maxOutboundChannelsPerEndpoint)
            {
                return(false);
            }

            return(true);
        }
        public ChannelManagerService(NameValueCollection parameters)
        {
            if (parameters == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters");
            }

            ChannelPoolSettings channelPoolSettings = new ChannelPoolSettings();

            foreach (string key in parameters.Keys)
            {
                if (string.IsNullOrEmpty(key))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(
                        SR2.GetString(SR2.Error_UnknownConfigurationParameter, key), "parameters");
                }
                else if (key.Equals(ChannelManagerService.IdleTimeoutSetting, StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        channelPoolSettings.IdleTimeout =
                            ConvertToTimeSpan(parameters[ChannelManagerService.IdleTimeoutSetting]);
                    }
                    catch (FormatException ex)
                    {
                        ArgumentException exception = new ArgumentException(
                            SR2.GetString(SR2.Error_InvalidIdleTimeout, parameters[ChannelManagerService.IdleTimeoutSetting]),
                            "parameters",
                            ex);

                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception);
                    }
                }
                else if (key.Equals(ChannelManagerService.LeaseTimeoutSetting, StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        channelPoolSettings.LeaseTimeout =
                            ConvertToTimeSpan(parameters[ChannelManagerService.LeaseTimeoutSetting]);
                    }
                    catch (FormatException ex)
                    {
                        ArgumentException exception = new ArgumentException(
                            SR2.GetString(SR2.Error_InvalidLeaseTimeout, parameters[ChannelManagerService.LeaseTimeoutSetting]),
                            "parameters",
                            ex);

                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception);
                    }
                }
                else if (key.Equals(ChannelManagerService.MaxIdleChannelsPerEndpointSetting, StringComparison.OrdinalIgnoreCase))
                {
                    try
                    {
                        channelPoolSettings.MaxOutboundChannelsPerEndpoint =
                            Convert.ToInt32(parameters[ChannelManagerService.MaxIdleChannelsPerEndpointSetting], System.Globalization.CultureInfo.CurrentCulture);
                    }
                    catch (FormatException ex)
                    {
                        ArgumentException exception = new ArgumentException(
                            SR2.GetString(SR2.Error_InvalidMaxIdleChannelsPerEndpoint, parameters[ChannelManagerService.MaxIdleChannelsPerEndpointSetting]),
                            "parameters",
                            ex);

                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception);
                    }
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(
                        SR2.GetString(SR2.Error_UnknownConfigurationParameter, key), "parameters");
                }
            }

            this.settings = channelPoolSettings;
            this.codeEndpoints = new List<ServiceEndpoint>();
        }
 public ChannelManagerService(ChannelPoolSettings settings)
     : this(settings, new List<ServiceEndpoint>())
 {
 }
 ChannelPoolSettings(ChannelPoolSettings poolToBeCloned)
 {
     this.idleTimeout  = poolToBeCloned.idleTimeout;
     this.leaseTimeout = poolToBeCloned.leaseTimeout;
     this.maxOutboundChannelsPerEndpoint = poolToBeCloned.maxOutboundChannelsPerEndpoint;
 }
Beispiel #13
0
 public OneWayBindingElement()
 {
     pool = new ChannelPoolSettings();
 }
Beispiel #14
0
 public ChannelPool(ChannelPoolSettings settings)
     : base(settings.MaxOutboundChannelsPerEndpoint, settings.IdleTimeout, settings.LeaseTimeout)
 {
 }
Beispiel #15
0
		internal ChannelPoolSettings (ChannelPoolSettings other)
		{
			IdleTimeout = other.IdleTimeout;
			LeaseTimeout = other.LeaseTimeout;
			MaxOutboundChannelsPerEndpoint = other.MaxOutboundChannelsPerEndpoint;
		}
Beispiel #16
0
 internal ChannelPoolSettings(ChannelPoolSettings other)
 {
     IdleTimeout  = other.IdleTimeout;
     LeaseTimeout = other.LeaseTimeout;
     MaxOutboundChannelsPerEndpoint = other.MaxOutboundChannelsPerEndpoint;
 }
Beispiel #17
0
 ChannelPoolSettings(ChannelPoolSettings poolToBeCloned)
 {
     _idleTimeout  = poolToBeCloned._idleTimeout;
     _leaseTimeout = poolToBeCloned._leaseTimeout;
     _maxOutboundChannelsPerEndpoint = poolToBeCloned._maxOutboundChannelsPerEndpoint;
 }
 ChannelPoolSettings(ChannelPoolSettings poolToBeCloned)
 {
     this.idleTimeout = poolToBeCloned.idleTimeout;
     this.leaseTimeout = poolToBeCloned.leaseTimeout;
     this.maxOutboundChannelsPerEndpoint = poolToBeCloned.maxOutboundChannelsPerEndpoint;
 }
Beispiel #19
0
 OneWayBindingElement(OneWayBindingElement other)
 {
     pool = new ChannelPoolSettings(other.pool);
 }
 public OneWayBindingElement()
 {
     this.channelPoolSettings = new ChannelPoolSettings();
     this.packetRoutable      = OneWayDefaults.PacketRoutable;
     this.maxAcceptedChannels = OneWayDefaults.MaxAcceptedChannels;
 }