30 using System.Reflection;
33 using System.Collections.Generic;
34 using OpenSim.Framework.Servers;
35 using OpenSim.Framework.Servers.HttpServer;
36 using OpenSim.Server.Base;
37 using OpenSim.Server.Handlers.Base;
40 namespace OpenSim.Server
44 private static readonly ILog m_log =
46 MethodBase.GetCurrentMethod().DeclaringType);
50 protected static List<IServiceConnector> m_ServiceConnectors =
51 new List<IServiceConnector>();
55 public static int Main(
string[] args)
58 ServicePointManager.DefaultConnectionLimit = 50;
59 ServicePointManager.UseNagleAlgorithm =
false;
63 string registryLocation;
65 IConfig serverConfig = m_Server.Config.Configs[
"Startup"];
66 if (serverConfig == null)
68 System.Console.WriteLine(
"Startup config section missing in .ini file");
69 throw new Exception(
"Configuration error");
72 string connList = serverConfig.GetString(
"ServiceConnectors", String.Empty);
74 registryLocation = serverConfig.GetString(
"RegistryLocation",
".");
76 IConfig servicesConfig = m_Server.Config.Configs[
"ServiceList"];
77 if (servicesConfig != null)
79 List<string> servicesList =
new List<string>();
80 if (connList != String.Empty)
81 servicesList.Add(connList);
83 foreach (
string k
in servicesConfig.GetKeys())
85 string v = servicesConfig.GetString(k);
86 if (v != String.Empty)
90 connList = String.Join(
",", servicesList.ToArray());
93 string[] conns = connList.Split(
new char[] {
',',
' ',
'\n',
'\r',
'\t'});
96 foreach (
string c
in conns)
98 if (c == String.Empty)
101 string configName = String.Empty;
105 string[] split1 = conn.Split(
new char[] {
'/'});
106 if (split1.Length > 1)
110 string[] split2 = split1[0].Split(
new char[] {
'@'});
111 if (split2.Length > 1)
113 configName = split2[0];
114 port = Convert.ToUInt32(split2[1]);
118 port = Convert.ToUInt32(split1[0]);
121 string[] parts = conn.Split(
new char[] {
':'});
122 string friendlyName = parts[0];
123 if (parts.Length > 1)
124 friendlyName = parts[1];
129 server = MainServer.GetHttpServer(port);
131 server = MainServer.Instance;
133 m_log.InfoFormat(
"[SERVER]: Loading {0} on port {1}", friendlyName, server.Port);
137 Object[] modargs =
new Object[] { m_Server.Config, server, configName };
140 if (connector == null)
142 modargs =
new Object[] { m_Server.Config, server };
146 if (connector != null)
148 m_ServiceConnectors.Add(connector);
149 m_log.InfoFormat(
"[SERVER]: {0} loaded successfully", friendlyName);
153 m_log.ErrorFormat(
"[SERVER]: Failed to load {0}", conn);
157 loader =
new PluginLoader(m_Server.Config, registryLocation);
159 int res = m_Server.Run();
161 Environment.Exit(res);
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.
static PluginLoader loader
static int Main(string[] args)