private Binding CreateInnerBinding()
        {
            Binding binding;
            Binding binding1;

            lock (WebSocketRelayedConnectionElement.bindingTable)
            {
                if (!WebSocketRelayedConnectionElement.bindingTable.TryGetValue(this.nameSettings, out binding))
                {
                    BindingElement[] bindingElementArray = new BindingElement[] { ClientMessageUtility.CreateInnerEncodingBindingElement(this.context), new RelayedOnewayTransportBindingElement(this.nameSettings.ServiceSettings.RelayClientAuthenticationType, RelayedOnewayConnectionMode.Unicast) };
                    CustomBinding    customBinding       = new CustomBinding(bindingElementArray)
                    {
                        CloseTimeout   = this.context.Binding.CloseTimeout,
                        Name           = this.context.Binding.Name,
                        Namespace      = this.context.Binding.Namespace,
                        OpenTimeout    = this.context.Binding.OpenTimeout,
                        ReceiveTimeout = this.context.Binding.ReceiveTimeout,
                        SendTimeout    = this.context.Binding.SendTimeout
                    };
                    binding = customBinding;
                    WebSocketRelayedConnectionElement.bindingTable.Add(this.nameSettings, binding);
                }
                binding1 = binding;
            }
            return(binding1);
        }
        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);
        }
Ejemplo n.º 3
0
        internal static new ChannelProtectionRequirements GetProtectionRequirements(BindingContext context)
        {
            AddressingVersion             wSAddressing10 = AddressingVersion.WSAddressing10;
            MessageEncodingBindingElement messageEncodingBindingElement = ClientMessageUtility.CreateInnerEncodingBindingElement(context);

            if (messageEncodingBindingElement != null)
            {
                wSAddressing10 = messageEncodingBindingElement.MessageVersion.Addressing;
            }
            return(RelayedOnewayTransportBindingElement.GetProtectionRequirements(wSAddressing10));
        }
            public RelayedOnewayAmqpListenerClient(BindingContext context, RelayedOnewayTransportBindingElement transportBindingElement, System.Uri uri, RelayedOnewayListener listener, EventTraceActivity activity) : base(context, transportBindingElement, uri, true, activity)
            {
                this.listener = listener;
                BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = ClientMessageUtility.CreateInnerEncodingBindingElement(context);

                this.encoder                  = binaryMessageEncodingBindingElement.CreateMessageEncoderFactory().Encoder;
                this.messageWrapper           = new MessageWrapper(this.encoder);
                this.bufferManager            = BufferManager.CreateBufferManager(transportBindingElement.MaxBufferPoolSize, transportBindingElement.MaxBufferSize);
                base.IsListener               = true;
                this.connectivitySettings     = context.BindingParameters.Find <ConnectivitySettings>();
                this.httpConnectivitySettings = context.BindingParameters.Find <HttpConnectivitySettings>();
            }
Ejemplo n.º 5
0
        private BindingContext CreateInnerListenerBindingContext(BindingContext context)
        {
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = ClientMessageUtility.CreateInnerEncodingBindingElement(context);
            NameSettings nameSetting = context.BindingParameters.Find <NameSettings>();
            TcpRelayTransportBindingElement tcpRelayTransportBindingElement = new TcpRelayTransportBindingElement(this.RelayClientAuthenticationType)
            {
                ManualAddressing           = base.ManualAddressing,
                HostNameComparisonMode     = this.HostNameComparisonMode,
                MaxBufferPoolSize          = this.MaxBufferPoolSize,
                MaxBufferSize              = this.MaxBufferSize,
                MaxReceivedMessageSize     = this.MaxReceivedMessageSize,
                TransferMode               = System.ServiceModel.TransferMode.Streamed,
                TransportProtectionEnabled = nameSetting.ServiceSettings.TransportProtection != RelayTransportProtectionMode.None
            };

            tcpRelayTransportBindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint = 100;
            tcpRelayTransportBindingElement.IsDynamic = nameSetting.ServiceSettings.IsDynamic;
            BindingElement[] bindingElementArray = new BindingElement[] { binaryMessageEncodingBindingElement, tcpRelayTransportBindingElement };
            CustomBinding    customBinding       = new CustomBinding(bindingElementArray)
            {
                CloseTimeout   = context.Binding.CloseTimeout,
                Name           = context.Binding.Name,
                Namespace      = context.Binding.Namespace,
                OpenTimeout    = context.Binding.OpenTimeout,
                ReceiveTimeout = context.Binding.ReceiveTimeout,
                SendTimeout    = context.Binding.SendTimeout
            };
            BindingParameterCollection bindingParameterCollection = new BindingParameterCollection();

            foreach (object bindingParameter in context.BindingParameters)
            {
                if (bindingParameter is MessageEncodingBindingElement)
                {
                    continue;
                }
                bindingParameterCollection.Add(bindingParameter);
            }
            Uri sbUri = RelayedHttpUtility.ConvertToSbUri(context.ListenUriBaseAddress);

            return(new BindingContext(customBinding, bindingParameterCollection, sbUri, context.ListenUriRelativeAddress, context.ListenUriMode));
        }