Esempio n. 1
0
        public void TestSameSimulatorNeighbouringRegionsTeleportV2()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            BaseHttpServer httpServer = new BaseHttpServer(99999);

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            AttachmentsModule              attModA = new AttachmentsModule();
            AttachmentsModule              attModB = new AttachmentsModule();
            EntityTransferModule           etmA    = new EntityTransferModule();
            EntityTransferModule           etmB    = new EntityTransferModule();
            LocalSimulationConnectorModule lscm    = new LocalSimulationConnectorModule();

            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(
                sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule());
            SceneHelpers.SetupSceneModules(
                sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());

            UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);

            AgentCircuitData  acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
            TestClient        tc  = new TestClient(acd, sceneA);
            List <TestClient> destinationTestClients = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);

            ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);

            beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);

            Assert.That(destinationTestClients.Count, Is.EqualTo(1));
            Assert.That(destinationTestClients[0], Is.Not.Null);

            InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);

            sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
                beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt   = new Vector3(20, 21, 22);

            // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement().  This
            // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to
            // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt
            // Both these operations will occur on different threads and will wait for each other.
            // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1
            // test protocol, where we are trying to avoid unpredictable async operations in regression tests.
            tc.OnTestClientSendRegionTeleport
                += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL)
                   => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null);

            m_numberOfAttachEventsFired = 0;
            sceneA.RequestTeleportLocation(
                beforeTeleportSp.ControllingClient,
                sceneB.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            // Check attachments have made it into sceneB
            ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);

            // This is appearance data, as opposed to actually rezzed attachments
            List <AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();

            Assert.That(sceneBAttachments.Count, Is.EqualTo(1));
            Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
            Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID));
            Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
            Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment
            List <SceneObjectGroup> actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments();

            Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1));
            SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];

            Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
            Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));

            Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check attachments have been removed from sceneA
            ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);

            // Since this is appearance data, it is still present on the child avatar!
            List <AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();

            Assert.That(sceneAAttachments.Count, Is.EqualTo(1));
            Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment, which should no longer exist
            List <SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();

            Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));

            Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
        }
        protected override void ReadConfig()
        {
            IConfig networkConfig = Config.Configs["Network"];

            if (networkConfig == null)
            {
                System.Console.WriteLine("Section 'Network' not found, server can't start");
                Thread.CurrentThread.Abort();
            }

            uint port = (uint)networkConfig.GetInt("port", 0);

            if (port == 0)
            {
                Thread.CurrentThread.Abort();
            }

            bool ssl_main     = networkConfig.GetBoolean("https_main", false);
            bool ssl_listener = networkConfig.GetBoolean("https_listener", false);

            m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);

            BaseHttpServer httpServer = null;

            //
            // This is where to make the servers:
            //
            //
            // Make the base server according to the port, etc.
            // ADD: Possibility to make main server ssl
            // Then, check for https settings and ADD a server to
            // m_Servers
            //
            if (!ssl_main)
            {
                httpServer = new BaseHttpServer(port);
            }
            else
            {
                string cert_path = networkConfig.GetString("cert_path", String.Empty);
                if (cert_path == String.Empty)
                {
                    System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
                    Thread.CurrentThread.Abort();
                }
                string cert_pass = networkConfig.GetString("cert_pass", String.Empty);
                if (cert_pass == String.Empty)
                {
                    System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
                    Thread.CurrentThread.Abort();
                }

                httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass);
            }

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            // If https_listener = true, then add an ssl listener on the https_port...
            if (ssl_listener == true)
            {
                uint https_port = (uint)networkConfig.GetInt("https_port", 0);

                string cert_path = networkConfig.GetString("cert_path", String.Empty);
                if (cert_path == String.Empty)
                {
                    System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
                    Thread.CurrentThread.Abort();
                }
                string cert_pass = networkConfig.GetString("cert_pass", String.Empty);
                if (cert_pass == String.Empty)
                {
                    System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
                    Thread.CurrentThread.Abort();
                }

                MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
            }
        }
Esempio n. 3
0
        public void TestSameSimulatorNeighbouringRegionsTeleportV1()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            BaseHttpServer httpServer = new BaseHttpServer(99999);

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            AttachmentsModule              attModA = new AttachmentsModule();
            AttachmentsModule              attModB = new AttachmentsModule();
            EntityTransferModule           etmA    = new EntityTransferModule();
            EntityTransferModule           etmB    = new EntityTransferModule();
            LocalSimulationConnectorModule lscm    = new LocalSimulationConnectorModule();

            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);
            IConfig entityTransferConfig = config.AddConfig("EntityTransfer");

            // In order to run a single threaded regression test we do not want the entity transfer module waiting
            // for a callback from the destination scene before removing its avatar data.
            entityTransferConfig.Set("wait_for_callback", false);

            modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(
                sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule());
            SceneHelpers.SetupSceneModules(
                sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());

            // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
            lscm.ServiceVersion = "SIMULATION/0.1";

            UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);

            AgentCircuitData  acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
            TestClient        tc  = new TestClient(acd, sceneA);
            List <TestClient> destinationTestClients = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);

            ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);

            beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);

            InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);

            sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
                beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt   = new Vector3(20, 21, 22);

            m_numberOfAttachEventsFired = 0;
            sceneA.RequestTeleportLocation(
                beforeTeleportSp.ControllingClient,
                sceneB.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            destinationTestClients[0].CompleteMovement();

            // Check attachments have made it into sceneB
            ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);

            // This is appearance data, as opposed to actually rezzed attachments
            List <AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();

            Assert.That(sceneBAttachments.Count, Is.EqualTo(1));
            Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
            Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID));
            Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
            Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment
            List <SceneObjectGroup> actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments();

            Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1));
            SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];

            Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
            Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));

            Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check attachments have been removed from sceneA
            ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);

            // Since this is appearance data, it is still present on the child avatar!
            List <AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();

            Assert.That(sceneAAttachments.Count, Is.EqualTo(1));
            Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));

            // This is the actual attachment, which should no longer exist
            List <SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();

            Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));

            Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
        }
Esempio n. 4
0
        protected override void ReadConfig()
        {
            IConfig networkConfig = Config.Configs["Network"];

            if (networkConfig == null)
            {
                System.Console.WriteLine("ERROR: Section [Network] not found, server can't start");
                Environment.Exit(1);
            }

            uint port = (uint)networkConfig.GetInt("port", 0);

            if (port == 0)
            {
                System.Console.WriteLine("ERROR: No 'port' entry found in [Network].  Server can't start");
                Environment.Exit(1);
            }

            bool ssl_main     = networkConfig.GetBoolean("https_main", false);
            bool ssl_listener = networkConfig.GetBoolean("https_listener", false);
            bool ssl_external = networkConfig.GetBoolean("https_external", false);

            m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);

            BaseHttpServer httpServer = null;

            //
            // This is where to make the servers:
            //
            //
            // Make the base server according to the port, etc.
            // ADD: Possibility to make main server ssl
            // Then, check for https settings and ADD a server to
            // m_Servers
            //
            if (!ssl_main)
            {
                httpServer = new BaseHttpServer(port);
            }
            else
            {
                string cert_path = networkConfig.GetString("cert_path", String.Empty);
                if (cert_path == String.Empty)
                {
                    System.Console.WriteLine("ERROR: Path to X509 certificate is missing, server can't start.");
                    Environment.Exit(1);
                }

                string cert_pass = networkConfig.GetString("cert_pass", String.Empty);
                if (cert_pass == String.Empty)
                {
                    System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start.");
                    Environment.Exit(1);
                }

                httpServer = new BaseHttpServer(port, ssl_main, cert_path, cert_pass);
            }

            MainServer.AddHttpServer(httpServer);
            MainServer.Instance = httpServer;

            // If https_listener = true, then add an ssl listener on the https_port...
            if (ssl_listener == true)
            {
                uint https_port = (uint)networkConfig.GetInt("https_port", 0);

                m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
                if (!ssl_external)
                {
                    string cert_path = networkConfig.GetString("cert_path", String.Empty);
                    if (cert_path == String.Empty)
                    {
                        System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
                        Thread.CurrentThread.Abort();
                    }
                    string cert_pass = networkConfig.GetString("cert_pass", String.Empty);
                    if (cert_pass == String.Empty)
                    {
                        System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
                        Thread.CurrentThread.Abort();
                    }

                    MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
                }
                else
                {
                    m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
                    MainServer.AddHttpServer(new BaseHttpServer(https_port));
                }
            }
        }
Esempio n. 5
0
 public void Startup(ConfigurationLoader loader)
 {
     m_HttpServer = loader.HttpServer;
 }
//        private int m_timeout = 1000;   //  increase timeout 250; now use the event one

        public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
        {
            m_server            = pSrv;
            m_WorkerThreadCount = pWorkerThreadCount;
            m_workerThreads     = new Thread[m_WorkerThreadCount];
        }
Esempio n. 7
0
        /// <summary>
        ///     Get an HTTPServer on the given port. It will create one if one does not exist
        /// </summary>
        /// <param name="port"></param>
        /// <returns></returns>
        public IHttpServer GetHttpServer(uint port)
        {
            if ((port == m_Port || port == 0) && HttpServer != null)
            {
                return(HttpServer);
            }

            bool        useHTTPS = m_config.Configs["Network"].GetBoolean("use_https", false);
            IHttpServer server;

            if (m_Servers.TryGetValue(port, out server) && server.Secure == useHTTPS)
            {
                return(server);
            }

            uint threadCount = m_config.Configs["Network"].GetUInt("HttpThreadCount", 5);

            // find out where we live
            string hostName;

            // been here before?
            if (Utilities.HostName == "")
            {
                hostName = m_config.Configs ["Network"].GetString("HostName", "0.0.0.0");

                if ((hostName == "") || (hostName == "0.0.0.0"))
                {
                    MainConsole.Instance.Info("[Network]: Retrieving the external IP address");
                    hostName = "http" + (useHTTPS ? "s" : "") + "://" + Utilities.GetExternalIp();
                }

                //Clean it up a bit
                if (hostName.StartsWith("http://") || hostName.StartsWith("https://"))
                {
                    hostName = hostName.Replace("https://", "").Replace("http://", "");
                }
                if (hostName.EndsWith("/"))
                {
                    hostName = hostName.Remove(hostName.Length - 1, 1);
                }

                // save this for posterity in case it is needed
                MainConsole.Instance.Info("[Network]: Network IP address has been set to " + hostName);
                Utilities.HostName = hostName;
            }
            else
            {
                hostName = Utilities.HostName;
            }

            server = new BaseHttpServer(port, hostName, useHTTPS, threadCount);

            try
            {
                server.Start();
            }
            catch (Exception)
            {
                //Remove the server from the list
                m_Servers.Remove(port);
                //Then pass the exception upwards
                throw;
            }
            if (m_Servers.Count == 0)
            {
                MainServer.Instance = server;
            }
            return(m_Servers[port] = server);
        }
Esempio n. 8
0
        /// <summary>
        /// Called publicly by server code that is not hosting a scene, but wants remote admin support
        /// </summary>
        /// <param name="server"></param>
        public void AddHandler(BaseHttpServer server)
        {
            m_log.Info("[RADMIN]: Remote Admin CoreInit");

            server.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("RemoteAdmin"), XmlRpcCommand));
        }
 public void RegisterHandlers(BaseHttpServer httpServer)
 {
 }
 /// <summary></summary>
 /// CapsHandlers is a cap handler container but also takes
 /// care of adding and removing cap handlers to and from the
 /// supplied BaseHttpServer.
 /// </summary>
 /// <param name="httpListener">base HTTP server</param>
 /// <param name="httpListenerHostname">host name of the HTTP server</param>
 /// <param name="httpListenerPort">HTTP port</param>
 public CapsHandlers(BaseHttpServer httpListener, string httpListenerHostname, uint httpListenerPort)
     : this(httpListener, httpListenerHostname, httpListenerPort, false)
 {
 }
Esempio n. 11
0
        public void TestInventoryDescendentsFetch()
        {
            TestHelpers.InMethod();
            TestHelpers.EnableLogging();

            BaseHttpServer httpServer = MainServer.Instance;
            Scene          scene      = new SceneHelpers().SetupScene();

            CapabilitiesModule    capsModule = new CapabilitiesModule();
            WebFetchInvDescModule wfidModule = new WebFetchInvDescModule(false);

            IConfigSource config = new IniConfigSource();

            config.AddConfig("ClientStack.LindenCaps");
            config.Configs["ClientStack.LindenCaps"].Set("Cap_FetchInventoryDescendents2", "localhost");

            SceneHelpers.SetupSceneModules(scene, config, capsModule, wfidModule);

            UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));

            // We need a user present to have any capabilities set up
            SceneHelpers.AddScenePresence(scene, ua.PrincipalID);

            TestHttpRequest req = new TestHttpRequest();

            OpenSim.Framework.Capabilities.Caps userCaps = capsModule.GetCapsForUser(ua.PrincipalID);
            PollServiceEventArgs pseArgs;

            userCaps.TryGetPollHandler("FetchInventoryDescendents2", out pseArgs);
            req.UriPath = pseArgs.Url;
            req.Uri     = new Uri(req.UriPath);

            // Retrieve root folder details directly so that we can request
            InventoryFolderBase folder = scene.InventoryService.GetRootFolder(ua.PrincipalID);

            OSDMap osdFolder = new OSDMap();

            osdFolder["folder_id"]     = folder.ID;
            osdFolder["owner_id"]      = ua.PrincipalID;
            osdFolder["fetch_folders"] = true;
            osdFolder["fetch_items"]   = true;
            osdFolder["sort_order"]    = 0;

            OSDArray osdFoldersArray = new OSDArray();

            osdFoldersArray.Add(osdFolder);

            OSDMap osdReqMap = new OSDMap();

            osdReqMap["folders"] = osdFoldersArray;

            req.Body = new MemoryStream(OSDParser.SerializeLLSDXmlBytes(osdReqMap));

            TestHttpClientContext context = new TestHttpClientContext(false);

            MainServer.Instance.OnRequest(context, new RequestEventArgs(req));

            // Drive processing of the queued inventory request synchronously.
            wfidModule.WaitProcessQueuedInventoryRequest();
            MainServer.Instance.PollServiceRequestManager.WaitPerformResponse();

//            System.Threading.Thread.Sleep(10000);

            OSDMap   responseOsd = (OSDMap)OSDParser.DeserializeLLSDXml(context.ResponseBody);
            OSDArray foldersOsd  = (OSDArray)responseOsd["folders"];
            OSDMap   folderOsd   = (OSDMap)foldersOsd[0];

            // A sanity check that the response has the expected number of descendents for a default inventory
            // TODO: Need a more thorough check.
            Assert.That((int)folderOsd["descendents"], Is.EqualTo(16));
        }
        protected override void StartupSpecific()
        {
            SceneManager = SceneManager.Instance;

            Initialize();

            IPAddress ipaddress = m_networkServersInfo.HttpListenerAddress;

            uint mainport = m_networkServersInfo.HttpListenerPort;
            uint mainSSLport = m_networkServersInfo.httpSSLPort;

            if (m_networkServersInfo.HttpUsesSSL && (mainport == mainSSLport))
            {
                m_log.Error("[REGION SERVER]: HTTP Server config failed.   HTTP Server and HTTPS server must be on different ports");
            }

            if(m_networkServersInfo.HttpUsesSSL)
            {
                m_httpServer = new BaseHttpServer(
                        mainSSLport, m_networkServersInfo.HttpUsesSSL,
                        m_networkServersInfo.HttpSSLCN,
                        m_networkServersInfo.HttpSSLCertPath, m_networkServersInfo.HttpSSLCNCertPass);
                m_httpServer.Start();
                MainServer.AddHttpServer(m_httpServer);
            }

            // unsecure main server
            BaseHttpServer server = new BaseHttpServer(ipaddress, mainport);
            if(!m_networkServersInfo.HttpUsesSSL)
            {
                m_httpServer = server;
                server.Start(m_networkServersInfo.HttpListenerPortMin, m_networkServersInfo.HttpListenerPortMax);
                // hack: update the config to the selected port
                m_networkServersInfo.HttpListenerPort = server.Port;
                Config.Configs["Network"].Set("http_listener_port", server.Port);
				m_httpServerPort = server.Port;
            }
            else
                server.Start();

            MainServer.AddHttpServer(server);
            MainServer.UnSecureInstance = server;

            MainServer.Instance = m_httpServer;

            // "OOB" Server
            if (m_networkServersInfo.ssl_listener)
            {
                if (!m_networkServersInfo.ssl_external)
                {
                    server = new BaseHttpServer(
                        m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener,
                        m_networkServersInfo.cert_path,
                        m_networkServersInfo.cert_pass);

                    m_log.InfoFormat("[REGION SERVER]: Starting OOB HTTPS server on port {0}", server.SSLPort);
                    server.Start();
                    MainServer.AddHttpServer(server);
                }
                else
                {
                    server = new BaseHttpServer(m_networkServersInfo.https_port);

                    m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port);
                    server.Start();
                    MainServer.AddHttpServer(server);
                }
            }

            base.StartupSpecific();
        }
Esempio n. 13
0
 public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout)
 {
     m_request = new BlockingQueue <PollServiceHttpRequest>();
     m_server  = pSrv;
     m_timeout = pTimeout;
 }
Esempio n. 14
0
 public static void AddHttpServer(BaseHttpServer server)
 {
     m_Servers.Add(server.Port, server);
 }