public SocketConnectionBindingElement(IConnectionElement connectionElement)
 {
     this.connectionElement      = connectionElement;
     this.enableKeepAlive        = true;
     this.listenBacklog          = 10;
     this.connectionPoolSettings = new SocketConnectionPoolSettings();
 }
Пример #2
0
 public DemuxSocketManager(IConnectionElement innerElement, int bufferSize, Uri uri)
 {
     this.innerElement  = innerElement;
     this.bufferSize    = bufferSize;
     this.uri           = uri;
     this.listenerTable = new Dictionary <string, DemuxSocketListener>();
 }
Пример #3
0
 public bool IsCompatible(IConnectionElement element)
 {
     if (!(element is DirectSocketElement))
     {
         return(false);
     }
     return(this.innerBinding == ((DirectSocketElement)element).innerBinding);
 }
Пример #4
0
 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 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 bool IsCompatible(IConnectionElement element)
 {
     if (!(element is DemuxSocketElement) || !this.innerElement.IsCompatible(((DemuxSocketElement)element).innerElement))
     {
         return(false);
     }
     return(this.type == ((DemuxSocketElement)element).type);
 }
 public bool IsCompatible(IConnectionElement element)
 {
     if (!(element is HybridConnectionElement))
     {
         return(false);
     }
     return(this.nameSettings.IsCompatible(((HybridConnectionElement)element).nameSettings));
 }
 public SocketConnectionTransportManager(SocketConnectionTransportManagerRegistration registration, SocketConnectionChannelListener channelListener)
 {
     base.ApplyListenerSettings(channelListener);
     this.listenUri         = channelListener.BaseUri;
     this.listenBacklog     = channelListener.ListenBacklog;
     this.registration      = registration;
     this.connectionElement = channelListener.ConnectionElement;
 }
 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);
 }
Пример #10
0
        public bool IsCompatible(IConnectionElement element)
        {
            RelayedSocketElement relayedSocketElement = element as RelayedSocketElement;

            if (relayedSocketElement == null)
            {
                return(false);
            }
            if (this.innerBinding == null && relayedSocketElement.InnerBinding == null)
            {
                return(this.nameSettings.IsCompatible(relayedSocketElement.nameSettings));
            }
            return(this.innerBinding == relayedSocketElement.InnerBinding);
        }
Пример #11
0
 public SocketConnectionTransportManagerRegistration(Uri listenUri, SocketConnectionChannelListener channelListener) : base(listenUri, channelListener.HostNameComparisonMode)
 {
     this.connectionBufferSize         = channelListener.ConnectionBufferSize;
     this.channelInitializationTimeout = channelListener.ChannelInitializationTimeout;
     this.teredoEnabled         = channelListener.TeredoEnabled;
     this.listenBacklog         = channelListener.ListenBacklog;
     this.maxOutputDelay        = channelListener.MaxOutputDelay;
     this.maxPendingConnections = channelListener.MaxPendingConnections;
     this.maxPendingAccepts     = channelListener.MaxPendingAccepts;
     this.idleTimeout           = channelListener.IdleTimeout;
     this.maxPooledConnections  = channelListener.MaxPooledConnections;
     this.transferMode          = channelListener.TransferMode;
     this.connectionElement     = channelListener.ConnectionElement;
     this.transportManagerTable = channelListener.TransportManagerTable;
 }
Пример #12
0
        public ConnectivityModeConnectionElement(TokenProvider tokenProvider, SocketSecurityRole socketSecurityMode, BindingContext context, NameSettings nameSettings, ConnectivitySettings connectivitySettings, HttpConnectivitySettings httpConnectivitySettings)
        {
            this.tokenProvider = tokenProvider;
            this.SecurityMode  = socketSecurityMode;
            this.cache         = new ConnectivityModeCache(connectivitySettings, httpConnectivitySettings);
            if (context == null || !(context.ListenUriBaseAddress != null))
            {
                return;
            }
            InternalConnectivityMode internalConnectivityMode = this.cache.GetInternalConnectivityMode(context.ListenUriBaseAddress);

            switch (internalConnectivityMode)
            {
            case InternalConnectivityMode.Tcp:
            {
                this.connectionElement = new RelayedSocketElement(context, nameSettings, this.tokenProvider, this.SecurityMode);
                return;
            }

            case InternalConnectivityMode.Http:
            {
                this.connectionElement = new WebStreamRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings, false);
                return;
            }

            case InternalConnectivityMode.Https:
            {
                this.connectionElement = new WebStreamRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings, true);
                return;
            }

            case InternalConnectivityMode.HttpsWebSocket:
            {
                this.connectionElement = new WebSocketRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings);
                return;
            }
            }
            throw new InvalidOperationException(SRClient.UnsupportedConnectivityMode(internalConnectivityMode));
        }
 public SocketConnectionBindingElement(IConnectionElement connectionElement, bool enableKeepAlive) : this(connectionElement)
 {
     this.enableKeepAlive = enableKeepAlive;
 }
 public bool IsCompatible(IConnectionElement element)
 {
     return(element is WebSocketRelayedConnectionElement);
 }
Пример #15
0
 public bool IsCompatible(IConnectionElement element)
 {
     return(element is ConnectivityModeConnectionElement);
 }
Пример #16
0
 public DemuxSocketElement(IConnectionElement innerElement, string type, DemuxSocketManager demuxManager)
 {
     this.innerElement = innerElement;
     this.type         = type;
     this.demuxManager = demuxManager;
 }
        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);
        }
 public bool IsCompatible(IConnectionElement element)
 {
     return(element is WebStreamOnewayClientConnectionElement);
 }
Пример #19
0
 public DemuxSocketElement(IConnectionElement innerElement, string type) : this(innerElement, type, null)
 {
 }