Пример #1
0
 public static DbusUtils.VisitorThreadInfo RunSignalsAsync(out System.Threading.Thread threadSignalLoop, Udbus.Core.ServiceConnectionParams serviceConnectionParams)
 {
     DbusUtils.VisitorThreadInfo threadInfo = new DbusUtils.VisitorThreadInfo(serviceConnectionParams);
     threadSignalLoop = DbusUtils.LoopSignalsThread();
     threadSignalLoop.IsBackground = true;
     threadSignalLoop.Start(threadInfo);
     return(threadInfo);
 }
Пример #2
0
        private void FinishRunHosts(Udbus.v4v.v4vConnection connection, Udbus.Core.ServiceConnectionParams serviceConnectionParams)
        {
            this.connection = connection;
            this.serviceConnectionParams = serviceConnectionParams;

            log.Info("Connection helloed with name {0} and signalName {1}", serviceConnectionParams.Name, serviceConnectionParams.SignalName);
            System.Uri uriBase = new System.Uri(Udbus.WCF.Constants.BaseAddress);

            new Udbus.WCF.Service.Host.Init.InitHostMakerRegistry();
            new global::XenClientGuestService.wcf.Hosts.Init.InitHostMakerRegistry();
            Udbus.WCF.Service.Host.RegistryDictionaryHolder registry = Udbus.WCF.Service.Host.HostMakerRegistry.RegistryDictionaryClone;

            log.Info("Launching hosts...");

            // Build all hosts including "special" properties host.
            ICollection <Udbus.WCF.Service.Host.ServiceHostCreationData> hostdata = Udbus.WCF.Service.Host.HostMakerRegistry.BuildAllHosts(
                registry.Values
                , new Udbus.WCF.Host.WCFServiceParams(serviceConnectionParams)
                , new Uri[] { uriBase }
                );

            System.ServiceModel.NetNamedPipeBinding namedpipeBinding = new System.ServiceModel.NetNamedPipeBinding();
            System.ServiceModel.Channels.Binding    binding          = namedpipeBinding;
            binding.SendTimeout    = TimeSpan.MaxValue;
            binding.ReceiveTimeout = TimeSpan.MaxValue;

            foreach (Udbus.WCF.Service.Host.ServiceHostCreationData host in hostdata)
            {
                host.Host.AddServiceEndpoint(host.CreationParams.ContractType, binding, host.CreationParams.RelativeName);
            }

            this.hosts = hostdata.Select <Udbus.WCF.Service.Host.ServiceHostCreationData, System.ServiceModel.ServiceHost>(Udbus.WCF.Service.Host.ServiceHostCreationData.DataToHost);
            DbusUtils.RunHosts(hosts);

            this.threadInfo = RunSignalsAsync(out this.threadSignalLoop, serviceConnectionParams);
        }