internal static Binding CreateDirectControlBindingElement(BindingContext context, TcpRelayTransportBindingElement transportBindingElement, IConnectionElement directDemuxSocketElement) { SocketConnectionBindingElement socketConnectionBindingElement = new SocketConnectionBindingElement(directDemuxSocketElement) { ChannelInitializationTimeout = transportBindingElement.ChannelInitializationTimeout, ConnectionBufferSize = transportBindingElement.ConnectionBufferSize }; socketConnectionBindingElement.ConnectionPoolSettings.GroupName = transportBindingElement.ConnectionPoolSettings.GroupName; socketConnectionBindingElement.ConnectionPoolSettings.IdleTimeout = transportBindingElement.ConnectionPoolSettings.IdleTimeout; socketConnectionBindingElement.ConnectionPoolSettings.LeaseTimeout = transportBindingElement.ConnectionPoolSettings.LeaseTimeout; socketConnectionBindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint = transportBindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint; socketConnectionBindingElement.ListenBacklog = transportBindingElement.ListenBacklog; socketConnectionBindingElement.MaxOutputDelay = transportBindingElement.MaxOutputDelay; socketConnectionBindingElement.MaxPendingAccepts = transportBindingElement.MaxPendingAccepts; socketConnectionBindingElement.MaxPendingConnections = transportBindingElement.MaxPendingConnections; socketConnectionBindingElement.ManualAddressing = false; socketConnectionBindingElement.MaxBufferPoolSize = (long)1048576; socketConnectionBindingElement.MaxBufferSize = 65536; socketConnectionBindingElement.MaxReceivedMessageSize = (long)socketConnectionBindingElement.MaxBufferSize; socketConnectionBindingElement.TransferMode = TransferMode.Buffered; BindingElement[] bindingElementArray = new BindingElement[] { ClientMessageUtility.CreateInnerEncodingBindingElement(context), socketConnectionBindingElement }; Binding customBinding = new CustomBinding(bindingElementArray) { CloseTimeout = context.Binding.CloseTimeout, OpenTimeout = context.Binding.OpenTimeout, ReceiveTimeout = context.Binding.ReceiveTimeout, SendTimeout = context.Binding.SendTimeout }; return(customBinding); }
internal override bool IsMatch(BindingElement b) { if (!base.IsMatch(b)) { return(false); } SocketConnectionBindingElement socketConnectionBindingElement = b as SocketConnectionBindingElement; if (socketConnectionBindingElement == null) { return(false); } if (this.listenBacklog != socketConnectionBindingElement.listenBacklog) { return(false); } if (this.teredoEnabled != socketConnectionBindingElement.teredoEnabled) { return(false); } if (this.connectionElement != socketConnectionBindingElement.ConnectionElement) { return(false); } if (this.SocketSecurityRole != socketConnectionBindingElement.SocketSecurityRole) { return(false); } if (!this.connectionPoolSettings.IsMatch(socketConnectionBindingElement.connectionPoolSettings)) { return(false); } return(true); }
protected SocketConnectionBindingElement(SocketConnectionBindingElement elementToBeCloned) : base(elementToBeCloned) { this.connectionElement = elementToBeCloned.ConnectionElement; this.enableKeepAlive = elementToBeCloned.enableKeepAlive; this.listenBacklog = elementToBeCloned.listenBacklog; this.teredoEnabled = elementToBeCloned.teredoEnabled; this.connectionPoolSettings = elementToBeCloned.connectionPoolSettings.Clone(); }
public SocketConnectionChannelFactory(SocketConnectionBindingElement bindingElement, BindingContext context, bool enableKeepAlive) : base(bindingElement, context, bindingElement.ConnectionPoolSettings.GroupName, bindingElement.ConnectionPoolSettings.IdleTimeout, bindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint) { this.enableKeepAlive = enableKeepAlive; this.connectionElement = bindingElement.ConnectionElement; this.leaseTimeout = bindingElement.ConnectionPoolSettings.LeaseTimeout; this.messageVersion = context.Binding.MessageVersion; this.securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context); }
protected SocketConnectionChannelListener(SocketConnectionBindingElement bindingElement, BindingContext context) : base(bindingElement, context) { this.listenBacklog = bindingElement.ListenBacklog; this.teredoEnabled = bindingElement.TeredoEnabled; base.SetIdleTimeout(bindingElement.ConnectionPoolSettings.IdleTimeout); base.SetMaxPooledConnections(bindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint); this.connectionElement = bindingElement.ConnectionElement; this.securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context); }
public SocketConnectionReplyChannelListener(SocketConnectionBindingElement bindingElement, BindingContext context) : base(bindingElement, context) { this.replyAcceptor = new Microsoft.ServiceBus.Channels.ConnectionOrientedTransportChannelListener.ConnectionOrientedTransportReplyChannelAcceptor(this); }
public SocketConnectionDuplexChannelListener(SocketConnectionBindingElement bindingElement, BindingContext context) : base(bindingElement, context) { this.duplexAcceptor = new Microsoft.ServiceBus.Channels.InputQueueChannelAcceptor <IDuplexSessionChannel>(this, () => this.GetPendingException()); }
private BindingElement BuildInnerBindingElement(BindingContext context) { SocketConnectionBindingElement socketConnectionBindingElement = null; NameSettings nameSetting = context.BindingParameters.Find <NameSettings>(); NameSettings relayClientAuthenticationType = nameSetting; if (nameSetting == null) { relayClientAuthenticationType = new NameSettings(); context.BindingParameters.Add(relayClientAuthenticationType); } relayClientAuthenticationType.ServiceSettings.TransportProtection = (this.transportProtectionEnabled ? RelayTransportProtectionMode.EndToEnd : RelayTransportProtectionMode.None); relayClientAuthenticationType.ServiceSettings.RelayClientAuthenticationType = this.RelayClientAuthenticationType; relayClientAuthenticationType.ServiceSettings.IsDynamic = this.IsDynamic; TokenProvider tokenProvider = TokenProviderUtility.CreateTokenProvider(context); switch (this.relayedConnectionMode) { case TcpRelayConnectionMode.Relayed: { if (relayClientAuthenticationType.ServiceSettings.ListenerType != ListenerType.RelayedHttp) { relayClientAuthenticationType.ServiceSettings.ListenerType = ListenerType.RelayedConnection; } ConnectivitySettings connectivitySetting = context.BindingParameters.Find <ConnectivitySettings>(); HttpConnectivitySettings httpConnectivitySetting = context.BindingParameters.Find <HttpConnectivitySettings>(); socketConnectionBindingElement = new SocketConnectionBindingElement(new ConnectivityModeConnectionElement(tokenProvider, (this.transportProtectionEnabled ? SocketSecurityRole.SslClient : SocketSecurityRole.None), context, relayClientAuthenticationType, connectivitySetting, httpConnectivitySetting)); break; } case TcpRelayConnectionMode.Hybrid: { if (base.ChannelInitializationTimeout < TimeSpan.FromSeconds(60)) { base.ChannelInitializationTimeout = TimeSpan.FromSeconds(60); } relayClientAuthenticationType.ServiceSettings.ListenerType = ListenerType.DirectConnection; socketConnectionBindingElement = new SocketConnectionBindingElement(new HybridConnectionElement(context, this, relayClientAuthenticationType, tokenProvider)); break; } default: { goto case TcpRelayConnectionMode.Relayed; } } socketConnectionBindingElement.ChannelInitializationTimeout = base.ChannelInitializationTimeout; socketConnectionBindingElement.ConnectionBufferSize = base.ConnectionBufferSize; socketConnectionBindingElement.ConnectionPoolSettings.GroupName = this.ConnectionPoolSettings.GroupName; socketConnectionBindingElement.ConnectionPoolSettings.IdleTimeout = this.ConnectionPoolSettings.IdleTimeout; socketConnectionBindingElement.ConnectionPoolSettings.LeaseTimeout = this.ConnectionPoolSettings.LeaseTimeout; socketConnectionBindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint = this.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint; socketConnectionBindingElement.ExposeConnectionProperty = base.ExposeConnectionProperty; socketConnectionBindingElement.HostNameComparisonMode = base.HostNameComparisonMode; socketConnectionBindingElement.InheritBaseAddressSettings = base.InheritBaseAddressSettings; socketConnectionBindingElement.ListenBacklog = this.ListenBacklog; socketConnectionBindingElement.ManualAddressing = base.ManualAddressing; socketConnectionBindingElement.MaxBufferPoolSize = this.MaxBufferPoolSize; socketConnectionBindingElement.MaxBufferSize = base.MaxBufferSize; socketConnectionBindingElement.MaxOutputDelay = base.MaxOutputDelay; socketConnectionBindingElement.MaxPendingAccepts = base.MaxPendingAccepts; socketConnectionBindingElement.MaxPendingConnections = base.MaxPendingConnections; socketConnectionBindingElement.MaxReceivedMessageSize = this.MaxReceivedMessageSize; socketConnectionBindingElement.TransferMode = base.TransferMode; socketConnectionBindingElement.TeredoEnabled = false; return(socketConnectionBindingElement); }
protected SocketConnectionChannelListener(SocketConnectionBindingElement bindingElement, BindingContext context) : base(bindingElement, context) { }