コード例 #1
0
        protected override void Initialise()
        {
            m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port);
            m_HttpServer.Start();

            if (m_Servers.Count > 0)
            {
                foreach (BaseHttpServer s in m_Servers.Values)
                {
                    if (!s.UseSSL)
                    {
                        m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", s.Port);
                    }
                    else
                    {
                        m_Log.InfoFormat("[SERVER]: Starting HTTPS server on port {0}", s.Port);
                    }

                    s.Start();
                }
            }

            if (MainConsole.Instance is RemoteConsole)
            {
                if (m_consolePort == 0)
                {
                    ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer);
                }
                else
                {
                    ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort));
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Get the default http server, an http server for a specific port
        /// and/or an http server bound to a specific address
        /// </summary>
        /// <remarks>
        /// If the requested HTTP server doesn't already exist then a new one is instantiated and started.
        /// </remarks>
        /// <returns></returns>
        /// <param name='port'>If 0 then the default HTTP server is returned.</param>
        /// <param name='ipaddr'>A specific IP address to bind to.  If null then the default IP address is used.</param>
        public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr)
        {
            if (port == 0)
            {
                return(instance);
            }

            if (instance != null && port == instance.Port)
            {
                return(instance);
            }

            return(m_Servers.GetOrAddIfNotExists(port, delegate()
            {
                BaseHttpServer server = new BaseHttpServer(port);

                if (ipaddr != null)
                {
                    server.ListenIPAddress = ipaddr;
                }

                server.Start();
                return server;
            }));
        }
コード例 #3
0
        void InitHttpServer(uint port)
        {
            m_httpServer = new BaseHttpServer(port);
            m_httpServer.Start();

            m_log.Info("[ASSETINVENTORY]: AssetInventory server is listening on port " + port);
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: VisionSim/Vision-Sim-NXG
        protected override void StartupSpecific()
        {
            InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));

            m_inventoryService          = new GridInventoryService(config.UserServerURL);
            m_inventoryService.DoLookup = config.SessionLookUp;
            m_inventoryService.AddPlugin(config.DatabaseProvider, config.DatabaseConnect);


            m_log.Info("[" + LogName + "]: Starting HTTP server ...");

            m_httpServer = new BaseHttpServer(config.HttpPort);

            AddHttpHandlers(config.RegionAccessToAgentsInventory);

            m_httpServer.Start();

            m_log.Info("[" + LogName + "]: Started HTTP server");

            new HGInventoryService(m_inventoryService, config.AssetServerURL, config.UserServerURL, m_httpServer, config.InventoryServerURL);

            base.StartupSpecific();

            m_console.Commands.AddCommand("inventoryserver", false, "add user",
                                          "add user",
                                          "Add a random user inventory", HandleAddUser);
        }
コード例 #5
0
        public override void SetUp()
        {
            base.SetUp();

            // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
            // variables and the VM is not restarted between tests.
            uint port = 9999;

            MainServer.RemoveHttpServer(port);

            BaseHttpServer server = new BaseHttpServer(port, false, 0, "");

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

            server.Start();

            m_engine    = new MockScriptEngine();
            m_urlModule = new UrlModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);

            SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);

            m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);

            // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
            // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
            m_lslApi = new LSL_Api();
            m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem);
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: VisionSim/Vision-Sim-NXG
        private void registerWithUserServer()
        {
            if (m_userServerModule.registerWithUserServer())
            {
                m_log.Info("[SERVER]: Starting HTTP process");
                m_httpServer = new BaseHttpServer(Cfg.HttpPort);

                m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
                m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
                m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
                m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
                m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
                m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);

                m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
                m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);

                m_httpServer.Start();
                m_log.Info("[SERVER]: Userserver registration was successful");
            }
            else
            {
                m_log.Error("[STARTUP]: Unable to connect to User Server");
            }
        }
コード例 #7
0
        protected override void StartupSpecific()
        {
            m_storageManager = CreateStorageManager();

            m_clientStackManager = CreateClientStackManager();

            Initialize();

            m_httpServer
                = new BaseHttpServer(
                      m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
                      m_networkServersInfo.HttpSSLCN);

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

            m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
            m_httpServer.Start();

            MainServer.Instance = m_httpServer;

            base.StartupSpecific();
        }
コード例 #8
0
 public void RegionLoaded(Scene scene)
 {
     if (IsEnabled())
     {
         // Start http server
         // Attach xmlrpc handlers
         m_log.Info("[XML RPC MODULE]: " +
                    "Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
         BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort);
         httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
         httpServer.Start();
     }
 }
コード例 #9
0
 public void PostInitialise()
 {
     if (IsEnabled())
     {
         // Start http server
         // Attach xmlrpc handlers
         m_log.Info("[REMOTE_DATA]: " +
                    "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
         BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort);
         httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
         httpServer.Start();
     }
 }
コード例 #10
0
ファイル: GridServerBase.cs プロジェクト: boodie/Opensim2
        protected override void StartupSpecific()
        {
            m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));

            m_log.Info("[GRID]: Starting HTTP process");
            m_httpServer = new BaseHttpServer(m_config.HttpPort);

            LoadPlugins();

            m_httpServer.Start();

            base.StartupSpecific();
        }
コード例 #11
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);
            }

            string hostName =
                m_config.Configs["Network"].GetString("HostName",
                                                      "http" + (useHTTPS ? "s" : "") + "://" + Utilities.GetExternalIp());
            uint threadCount = m_config.Configs["Network"].GetUInt("HttpThreadCount", 5);

            //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);
            }

            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);
        }
コード例 #12
0
        protected override void StartupSpecific()
        {
            m_storageManager = CreateStorageManager();

            m_clientStackManager = CreateClientStackManager();

            Initialize();

            // Main HTTP server first
            m_httpServer          = new BaseHttpServer(m_httpServerPort, null);
            m_httpServer.HostName = m_networkServersInfo.HostName;
            MainServer.AddHttpServer(m_httpServer);

            m_log.InfoFormat("[REGION]: Starting HTTP server on {0}:{1}", m_httpServer.HostName, m_httpServerPort);
            m_httpServer.Start();

            // If specified configure an ssl server for use as well
            // you need a Cert Request/Signed pair installed in the MY store with the CN specified
            if (m_networkServersInfo.HttpUsesSSL)
            {
                if (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)
                {
                    m_log.Error("[HTTP]: HTTP Server config failed.   HTTP Server and HTTPS server must be on different ports");
                }
                else
                {
                    /// XXX Should also support specifying an IP Address
                    BaseHttpServer secureServer = new BaseHttpServer(m_networkServersInfo.httpSSLPort, null);
                    secureServer.HostName = m_networkServersInfo.HostName;

                    if (m_networkServersInfo.HttpSSLCN != null)
                    {
                        secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCN, m_networkServersInfo.sslProtocol);
                    }
                    else
                    {
                        secureServer.SetSecureParams(m_networkServersInfo.HttpSSLCert, m_networkServersInfo.HttpSSLPassword, m_networkServersInfo.sslProtocol);
                    }

                    MainServer.AddHttpServer(secureServer);

                    m_log.Info("[REGION]: Starting HTTPS server");
                    secureServer.Start();
                }
            }

            base.StartupSpecific();
        }
コード例 #13
0
        protected override void StartupSpecific()
        {
            SceneManager = SceneManager.Instance;

            Initialize();

            m_httpServer
                = new BaseHttpServer(
                      m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
                      m_networkServersInfo.HttpSSLCN);

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

            m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
            m_httpServer.Start();

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

            // "OOB" Server
            if (m_networkServersInfo.ssl_listener)
            {
                if (!m_networkServersInfo.ssl_external)
                {
                    BaseHttpServer 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 HTTPS server on port {0}", server.Port);
                    MainServer.AddHttpServer(server);
                    server.Start();
                }
                else
                {
                    BaseHttpServer server = new BaseHttpServer(
                        m_networkServersInfo.https_port);

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

            base.StartupSpecific();
        }
コード例 #14
0
 public void RegionLoaded(IScene scene)
 {
     if (IsEnabled() && !m_httpServerStarted)
     {
         m_httpServerStarted = true;
         // Start http server
         // Attach xmlrpc handlers
         MainConsole.Instance.Info("[XMLRPC MODULE]: " +
                                   "Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
         BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort, MainServer.Instance.HostName,
                                                        false);
         httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
         httpServer.Start();
     }
     m_scriptModule = scene.RequestModuleInterface <IScriptModule>();
 }
コード例 #15
0
ファイル: XMLRPCModule.cs プロジェクト: nhede/WhiteCore-Dev
 public void FinishedStartup()
 {
     if (IsEnabled() && !ServerStarted())
     {
         m_httpServerStarted = true;
         // Start http server
         // Attach xmlrpc handlers
         MainConsole.Instance.Info("[XMLRPC MODULE]: " +
                                   "Starting up XMLRPC Server on port " + m_remoteDataPort +
                                   " for llRemoteData commands.");
         IHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort, MainServer.Instance.HostName,
                                                     false, 1);
         httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
         httpServer.Start();
     }
 }
コード例 #16
0
        public IHttpServer GetHttpServer(uint port, bool secure, string certPath, string certPass, SslProtocols sslProtocol)
        {
            if ((port == m_Port || port == 0) && HttpServer != null)
            {
                return(HttpServer);
            }

            BaseHttpServer server;

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

            string hostName =
                m_config.Configs["Network"].GetString("HostName", "http" + (secure ? "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);
            }

            server = new BaseHttpServer(port, hostName, secure);

            try
            {
                if (secure)//Set these params now
                {
                    server.SetSecureParams(certPath, certPass, sslProtocol);
                }
                server.Start();
            }
            catch (Exception)
            {
                //Remove the server from the list
                m_Servers.Remove(port);
                //Then pass the exception upwards
                throw;
            }

            return(m_Servers[port] = server);
        }
コード例 #17
0
ファイル: GridServerBase.cs プロジェクト: lbgrid/halcyon
        protected override void StartupSpecific()
        {
            m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));

            m_log.Info("[GRID]: Starting HTTP process");
            m_httpServer = new BaseHttpServer(m_config.HttpPort, null);

            LoadPlugins();

            m_httpServer.Start();

            m_radmin = new InWorldz.RemoteAdmin.RemoteAdmin();
            m_radmin.AddCommand("GridService", "Shutdown", GridServerShutdownHandler);
            m_radmin.AddHandler(m_httpServer);

            base.StartupSpecific();
        }
コード例 #18
0
        protected override void Initialise()
        {
            m_Log.InfoFormat("[SERVER]: Starting HTTP server on port {0}", m_HttpServer.Port);
            m_HttpServer.Start();

            if (MainConsole.Instance is RemoteConsole)
            {
                if (m_consolePort == 0)
                {
                    ((RemoteConsole)MainConsole.Instance).SetServer(m_HttpServer);
                }
                else
                {
                    ((RemoteConsole)MainConsole.Instance).SetServer(GetHttpServer(m_consolePort));
                }
            }
        }
コード例 #19
0
        public override void SetUp()
        {
            base.SetUp();

            // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
            // variables and the VM is not restarted between tests.
            uint port = 9999;

            MainServer.RemoveHttpServer(port);

            BaseHttpServer server = new BaseHttpServer(port, false, 0, "");

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

            server.Start(false);
        }
コード例 #20
0
ファイル: Main.cs プロジェクト: NoahStarfinder/My-Halcyon
        private void registerWithUserServer()
        {
retry:

            if (m_userServerModule.registerWithUserServer())
            {
                m_log.Info("[SERVER]: Starting HTTP process");
                m_httpServer = new BaseHttpServer(Cfg.HttpPort, null);

                m_httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
                m_httpServer.AddXmlRPCHandler("logout_of_simulator", msgsvc.UserLoggedOff);
                m_httpServer.AddXmlRPCHandler("get_presence_info_bulk", msgsvc.GetPresenceInfoBulk);
                m_httpServer.AddXmlRPCHandler("process_region_shutdown", msgsvc.ProcessRegionShutdown);
                m_httpServer.AddXmlRPCHandler("agent_location", msgsvc.AgentLocation);
                m_httpServer.AddXmlRPCHandler("agent_leaving", msgsvc.AgentLeaving);
                m_httpServer.AddXmlRPCHandler("region_startup", m_regionModule.RegionStartup);
                m_httpServer.AddXmlRPCHandler("region_shutdown", m_regionModule.RegionShutdown);

                // New Style
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("login_to_simulator"), msgsvc.UserLoggedOn));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("logout_of_simulator"), msgsvc.UserLoggedOff));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("get_presence_info_bulk"), msgsvc.GetPresenceInfoBulk));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("process_region_shutdown"), msgsvc.ProcessRegionShutdown));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("agent_location"), msgsvc.AgentLocation));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("agent_leaving"), msgsvc.AgentLeaving));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("region_startup"), m_regionModule.RegionStartup));
                m_httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("region_shutdown"), m_regionModule.RegionShutdown));

                m_radmin = new InWorldz.RemoteAdmin.RemoteAdmin(Cfg.SSLPublicCertFile);
                m_radmin.AddCommand("MessagingService", "Shutdown", MessagingServerShutdownHandler);
                m_radmin.AddHandler(m_httpServer);

                m_httpServer.Start();

                m_log.Info("[SERVER]: Userserver registration was successful");
            }
            else
            {
                m_log.Error("[STARTUP]: Unable to connect to User Server, retrying in 5 seconds");
                System.Threading.Thread.Sleep(5000);
                goto retry;
            }
        }
コード例 #21
0
        protected override void StartupSpecific()
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            SceneManager         = SceneManager.Instance;
            m_clientStackManager = CreateClientStackManager();

            Initialize();

            m_httpServer
                = new BaseHttpServer(
                      m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort,
                      m_networkServersInfo.HttpSSLCN);

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

            m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
            m_httpServer.Start();

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

            // "OOB" Server
            if (m_networkServersInfo.ssl_listener)
            {
                BaseHttpServer 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 HTTPS server on port {0}", server.Port);
                MainServer.AddHttpServer(server);
                server.Start();
            }

            base.StartupSpecific();
        }
コード例 #22
0
ファイル: XMLRPCModule.cs プロジェクト: digitalmystic/halcyon
        public void PostInitialize()
        {
            if (IsEnabled())
            {
                // Start http server
                // Attach xmlrpc handlers
                m_log.Info("[REMOTE_DATA]: " +
                           "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");

                BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort, null);

                // XmlRpc
                httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);

                // New Style
                httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("llRemoteData"), XmlRpcRemoteData));

                httpServer.Start();
            }
        }
コード例 #23
0
ファイル: App.xaml.cs プロジェクト: ummarbhutta/iotweb
 /// <summary>
 /// Initializes the singleton application object.  This is the first line of authored code
 /// executed, and as such is the logical equivalent of main() or WinMain().
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     // Run the web server
     m_server = new HttpServer(8000, new SessionConfiguration());
     m_server.AddHttpRequestHandler(
         "/",
         new HttpResourceHandler(
             Utilities.GetContainingAssembly(typeof(Program)),
             "Resources.Site",
             "index.html"
             )
         );
     m_server.AddWebSocketRequestHandler(
         "/sockets/",
         new WebSocketHandler()
         );
     m_server.Start();
 }
コード例 #24
0
ファイル: Main.cs プロジェクト: boodie/Opensim2
        protected override void StartupSpecific()
        {
            AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));

            m_log.Info("[ASSET]: Setting up asset DB");
            setupDB(config);

            m_log.Info("[ASSET]: Loading default asset set from '" + config.AssetSetsLocation + "'");
            LoadDefaultAssets(config.AssetSetsLocation);

            m_log.Info("[ASSET]: Starting HTTP process");
            m_httpServer = new BaseHttpServer(config.HttpPort);

            m_stats = StatsManager.StartCollectingAssetStats();

            AddHttpHandlers();

            m_httpServer.Start();

            base.StartupSpecific();
        }
コード例 #25
0
        public static Scene CreateScene(ushort httpPort, uint xloc, uint yloc)
        {
            //2130706433 = 127.0.0.1
            BaseHttpServer server       = new BaseHttpServer(httpPort, new System.Net.IPAddress(2130706433));
            var            commsManager = new OpenSim.Framework.Communications.CommunicationsManager(new OpenSim.Framework.NetworkServersInfo(), server,
                                                                                                     new AssetCache(), new LibraryRootFolder(".", "Library"));
            var gridSvc    = new SceneCommunicationService(commsManager);
            var regionInfo = new OpenSim.Framework.RegionInfo(xloc, yloc,
                                                              new System.Net.IPEndPoint(new System.Net.IPAddress(2130706433), 9001),
                                                              "localhost");

            var restComms = new RESTInterregionComms();

            gridSvc.UnitTest_SetCommsOut(restComms);
            Scene scene = new Scene(regionInfo, commsManager, gridSvc);

            restComms.Initialize_Unittest(scene);

            server.Start();



            return(scene);
        }
コード例 #26
0
ファイル: HttpServerBase.cs プロジェクト: boodie/Opensim2
 protected override void Initialise()
 {
     m_HttpServer.Start();
 }
コード例 #27
0
        /// <summary>
        /// Performs initialisation of the world, such as loading configuration from disk.
        /// </summary>
        public virtual void StartUp()
        {
            this.regionData = new RegionInfo();
            try
            {
                this.localConfig = new XmlConfig(m_config);
                this.localConfig.LoadData();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            m_console.WriteLine("Main.cs:Startup() - Loading configuration");
            this.regionData.InitConfig(this.m_sandbox, this.localConfig);
            this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change


            GridServers = new Grid();
            if (m_sandbox)
            {
                GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
                GridServers.GridDll  = "OpenSim.GridInterfaces.Local.dll";

                m_console.WriteLine("Starting in Sandbox mode");
            }
            else
            {
                if (this.gridLocalAsset)
                {
                    GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
                }
                else
                {
                    GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
                }
                GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";

                m_console.WriteLine("Starting in Grid mode");
            }

            try
            {
                GridServers.Initialise();
            }
            catch (Exception e)
            {
                m_console.WriteLine(e.Message + "\nSorry, could not setup the grid interface");
                Environment.Exit(1);
            }

            startuptime = DateTime.Now;

            try
            {
                AssetCache     = new AssetCache(GridServers.AssetServer);
                InventoryCache = new InventoryCache();
            }
            catch (Exception e)
            {
                m_console.WriteLine(e.Message + "\nSorry, could not setup local cache");
                Environment.Exit(1);
            }

            //should be passing a IGenericConfig object to these so they can read the config data they want from it
            GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
            IGridServer gridServer = GridServers.GridServer;

            gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);

            this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
            this.physManager.LoadPlugins();

            this.CustomiseStartup();

            m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
            // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);

            BaseHttpServer httpServer       = new BaseHttpServer(regionData.IPListenPort);
            LoginServer    loginServer      = null;
            LoginServer    adminLoginServer = null;

            bool sandBoxWithLoginServer = m_loginserver && m_sandbox;

            if (sandBoxWithLoginServer)
            {
                loginServer = new LoginServer(gridServer, regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts);
                loginServer.Startup();

                if (user_accounts)
                {
                    //sandbox mode with loginserver using accounts
                    this.GridServers.UserServer = loginServer;
                    adminLoginServer            = loginServer;

                    httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod);
                }
                else
                {
                    //sandbox mode with loginserver not using accounts
                    httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
                }
            }

            AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer);

            adminWebFront.LoadMethods(httpServer);

            m_console.WriteLine("Main.cs:Startup() - Starting HTTP server");
            httpServer.Start();

            MainServerListener();

            m_heartbeatTimer.Enabled  = true;
            m_heartbeatTimer.Interval = 100;
            m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
        }
コード例 #28
0
        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();
            }
            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();
        }
コード例 #29
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", 10);

            // find out where we live
            string hostName;

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

                // special case for 'localhost'.. try for an external network address then
                if ((hostName.ToLower() == "localip"))
                {
                    MainConsole.Instance.Info("[Network]: Retrieving the local system IP address");
                    hostName = Utilities.GetLocalIp();
                }

                // nothing set in the config.. try for an external network address then
                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://", StringComparison.OrdinalIgnoreCase) || hostName.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
                {
                    hostName = hostName.Replace("https://", "").Replace("http://", "");
                }
                if (hostName.EndsWith("/", StringComparison.Ordinal))
                {
                    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;
            }

            return(m_Servers[port] = server);
        }