aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/OpenSimMain.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer/OpenSimMain.cs')
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs59
1 files changed, 42 insertions, 17 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index c0fe95b..8bbdcd5 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -45,6 +45,7 @@ using OpenSim.Assets;
45using OpenSim.CAPS; 45using OpenSim.CAPS;
46using OpenSim.Framework.Console; 46using OpenSim.Framework.Console;
47using OpenSim.Physics.Manager; 47using OpenSim.Physics.Manager;
48using OpenSim.GenericConfig;
48using Nwc.XmlRpc; 49using Nwc.XmlRpc;
49using OpenSim.Servers; 50using OpenSim.Servers;
50 51
@@ -53,7 +54,9 @@ namespace OpenSim
53 54
54 public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback 55 public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback
55 { 56 {
56 private SimConfig Cfg; 57 //private SimConfig Cfg;
58 private IGenericConfig localConfig;
59 //private IGenericConfig remoteConfig;
57 private PhysicsManager physManager; 60 private PhysicsManager physManager;
58 private Grid GridServers; 61 private Grid GridServers;
59 private BaseHttpServer _httpServer; 62 private BaseHttpServer _httpServer;
@@ -64,6 +67,7 @@ namespace OpenSim
64 //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>(); 67 //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
65 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); 68 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
66 private DateTime startuptime; 69 private DateTime startuptime;
70 private RegionInfo regionData;
67 71
68 public Socket Server; 72 public Socket Server;
69 private IPEndPoint ServerIncoming; 73 private IPEndPoint ServerIncoming;
@@ -74,7 +78,7 @@ namespace OpenSim
74 private AsyncCallback ReceivedData; 78 private AsyncCallback ReceivedData;
75 79
76 private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); 80 private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
77 private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll"; 81 //private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
78 public string m_physicsEngine; 82 public string m_physicsEngine;
79 public bool m_sandbox = false; 83 public bool m_sandbox = false;
80 public bool m_loginserver; 84 public bool m_loginserver;
@@ -94,6 +98,30 @@ namespace OpenSim
94 98
95 public virtual void StartUp() 99 public virtual void StartUp()
96 { 100 {
101 this.regionData = new RegionInfo();
102 try
103 {
104 this.localConfig = new XmlConfig("simconfig.xml");
105 this.localConfig.LoadData();
106 }
107 catch (Exception e)
108 {
109 Console.WriteLine(e.Message);
110 }
111
112 string configfromgrid = localConfig.GetAttribute("ConfigFromGrid");
113 if (configfromgrid == "true")
114 {
115 //config from remote server is not implemented yet
116 //this.remoteConfig = new RemoteConfig(localConfig.GetAttribute("RemoteConfigURL"), localConfig.GetAttribute("SimUUID"));
117 //this.remoteConfig.LoadData();
118 //this.regionData.InitConfig(this.m_sandbox, this.remoteConfig);
119 //this.remoteConfig.Close();
120 }
121 else
122 {
123 this.regionData.InitConfig(this.m_sandbox, this.localConfig);
124 }
97 125
98 GridServers = new Grid(); 126 GridServers = new Grid();
99 if (m_sandbox) 127 if (m_sandbox)
@@ -120,17 +148,14 @@ namespace OpenSim
120 148
121 // We check our local database first, then the grid for config options 149 // We check our local database first, then the grid for config options
122 m_console.WriteLine("Main.cs:Startup() - Loading configuration"); 150 m_console.WriteLine("Main.cs:Startup() - Loading configuration");
123 Cfg = this.LoadConfigDll(this.ConfigDll); 151 //Cfg = this.LoadConfigDll(this.ConfigDll);
124 Cfg.InitConfig(this.m_sandbox); 152 //Cfg.InitConfig(this.m_sandbox);
125 m_console.WriteLine("Main.cs:Startup() - Contacting gridserver");
126 Cfg.LoadFromGrid();
127 153
128 PacketServer packetServer = new PacketServer(this); 154 PacketServer packetServer = new PacketServer(this);
129 155
130 m_console.WriteLine("Main.cs:Startup() - We are " + Cfg.RegionName + " at " + Cfg.RegionLocX.ToString() + "," + Cfg.RegionLocY.ToString()); 156 m_console.WriteLine("Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString());
131 m_console.WriteLine("Initialising world"); 157 m_console.WriteLine("Initialising world");
132 LocalWorld = new World(this._packetServer.ClientThreads, Cfg.RegionHandle, Cfg.RegionName, Cfg); 158 LocalWorld = new World(this._packetServer.ClientThreads, regionData.RegionHandle, regionData.RegionName);
133 //LocalWorld.LandMap = Cfg.LoadWorld();
134 LocalWorld.InventoryCache = InventoryCache; 159 LocalWorld.InventoryCache = InventoryCache;
135 LocalWorld.AssetCache = AssetCache; 160 LocalWorld.AssetCache = AssetCache;
136 161
@@ -147,10 +172,10 @@ namespace OpenSim
147 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use 172 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
148 LocalWorld.PhysScene.SetTerrain(LocalWorld.LandMap); 173 LocalWorld.PhysScene.SetTerrain(LocalWorld.LandMap);
149 174
150 GridServers.AssetServer.SetServerInfo(Cfg.AssetURL, Cfg.AssetSendKey); 175 //should be passing a IGenericConfig object to these so they can read the config data they want from it
151 //GridServers.GridServer.SetServerInfo(Cfg.GridURL, Cfg.GridSendKey, Cfg.GridRecvKey); 176 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
152 IGridServer gridServer = GridServers.GridServer; 177 IGridServer gridServer = GridServers.GridServer;
153 gridServer.SetServerInfo(Cfg.GridURL, Cfg.GridSendKey, Cfg.GridRecvKey); 178 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
154 179
155 LocalWorld.LoadPrimsFromStorage(); 180 LocalWorld.LoadPrimsFromStorage();
156 181
@@ -161,7 +186,7 @@ namespace OpenSim
161 186
162 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server"); 187 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
163 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); 188 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
164 _httpServer = new BaseHttpServer(Cfg.IPListenPort); 189 _httpServer = new BaseHttpServer(regionData.IPListenPort);
165 190
166 if (gridServer.GetName() == "Remote") 191 if (gridServer.GetName() == "Remote")
167 { 192 {
@@ -195,7 +220,7 @@ namespace OpenSim
195 bool sandBoxWithLoginServer = m_loginserver && m_sandbox; 220 bool sandBoxWithLoginServer = m_loginserver && m_sandbox;
196 if (sandBoxWithLoginServer) 221 if (sandBoxWithLoginServer)
197 { 222 {
198 loginServer = new LoginServer(gridServer, Cfg.IPListenAddr, Cfg.IPListenPort, this.user_accounts); 223 loginServer = new LoginServer(gridServer, regionData.IPListenAddr, regionData.IPListenPort, this.user_accounts);
199 loginServer.Startup(); 224 loginServer.Startup();
200 225
201 if( user_accounts ) 226 if( user_accounts )
@@ -294,9 +319,9 @@ namespace OpenSim
294 private void MainServerListener() 319 private void MainServerListener()
295 { 320 {
296 m_console.WriteLine("Main.cs:MainServerListener() - New thread started"); 321 m_console.WriteLine("Main.cs:MainServerListener() - New thread started");
297 m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + Cfg.IPListenAddr + ":" + Cfg.IPListenPort); 322 m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + regionData.IPListenAddr + ":" + regionData.IPListenPort);
298 323
299 ServerIncoming = new IPEndPoint(IPAddress.Any, Cfg.IPListenPort); 324 ServerIncoming = new IPEndPoint(IPAddress.Any, regionData.IPListenPort);
300 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 325 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
301 Server.Bind(ServerIncoming); 326 Server.Bind(ServerIncoming);
302 327