public DirectSocketListener(int bufferSize, Uri uri, Binding innerBinding)
        {
            this.bufferSize    = bufferSize;
            this.probingClient = new ProbingClient(uri.Host, ConnectConstants.DefaultProbePorts);
            Uri[] uriArray = new Uri[] { uri };
            this.serviceHost = new ConfigurationlessServiceHost(this, uriArray);
            ServiceErrorHandlerBehavior serviceErrorHandlerBehavior = new ServiceErrorHandlerBehavior();

            serviceErrorHandlerBehavior.HandleError += new EventHandler <ServiceErrorEventArgs>((object s, ServiceErrorEventArgs e) => Fx.Exception.TraceHandled(e.Exception, "DirectSocketListener.IErrorHandler.HandleError", null));
            this.serviceHost.Description.Behaviors.Add(serviceErrorHandlerBehavior);
            this.serviceHost.AddServiceEndpoint(typeof(IDirectConnectionControl), innerBinding, "");
            this.connectionSessions = new Dictionary <string, DirectConnectionSession>();
            this.socketQueue        = new InputQueue <Microsoft.ServiceBus.Channels.IConnection>();
            this.mutex    = new object();
            this.Activity = new EventTraceActivity();
        }
Esempio n. 2
0
        public void Initialize(int bufferSize, Uri uri, Binding innerBinding)
        {
            this.bufferSize = bufferSize;
            this.uri        = uri;
            ServiceEndpoint serviceEndpoint = this.serviceHost.AddServiceEndpoint(typeof(IRelayedConnectionControl), innerBinding, this.uri);

            serviceEndpoint.Behaviors.Add(this.nameSettings);
            TransportClientEndpointBehavior transportClientEndpointBehavior = new TransportClientEndpointBehavior(this.tokenProvider);

            serviceEndpoint.Behaviors.Add(transportClientEndpointBehavior);
            serviceEndpoint.Behaviors.Add(this.innerConnectionStatus);
            if (this.connectivitySettingsBehavior != null)
            {
                serviceEndpoint.Behaviors.Add(this.connectivitySettingsBehavior);
            }
            ServiceErrorHandlerBehavior serviceErrorHandlerBehavior = new ServiceErrorHandlerBehavior();

            serviceErrorHandlerBehavior.HandleError += new EventHandler <ServiceErrorEventArgs>((object s, ServiceErrorEventArgs e) => Fx.Exception.TraceHandled(e.Exception, "RelayedSocketListener.IErrorHandler.HandleError", null));
            this.serviceHost.Description.Behaviors.Add(serviceErrorHandlerBehavior);
        }