aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/OpenSimMain.cs
diff options
context:
space:
mode:
authorMW2007-04-15 09:45:34 +0000
committerMW2007-04-15 09:45:34 +0000
commit990680027f682ab3186c5dd9615249dca98d06fe (patch)
treebf3f68cd087c549a9aa64131ddcfd5534dbd6a7d /OpenSim.RegionServer/OpenSimMain.cs
parentunbroke sandbox mode (diff)
downloadopensim-SC-990680027f682ab3186c5dd9615249dca98d06fe.zip
opensim-SC-990680027f682ab3186c5dd9615249dca98d06fe.tar.gz
opensim-SC-990680027f682ab3186c5dd9615249dca98d06fe.tar.bz2
opensim-SC-990680027f682ab3186c5dd9615249dca98d06fe.tar.xz
Started to fix sandbox mode
Diffstat (limited to 'OpenSim.RegionServer/OpenSimMain.cs')
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs131
1 files changed, 72 insertions, 59 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index b239f15..2492ee2 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -48,7 +48,7 @@ using OpenSim.Framework.Console;
48using OpenSim.Physics.Manager; 48using OpenSim.Physics.Manager;
49using Nwc.XmlRpc; 49using Nwc.XmlRpc;
50using OpenSim.Servers; 50using OpenSim.Servers;
51using OpenSim.GenericConfig; 51using OpenSim.GenericConfig;
52 52
53namespace OpenSim 53namespace OpenSim
54{ 54{
@@ -164,18 +164,22 @@ namespace OpenSim
164 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); 164 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
165 IGridServer gridServer = GridServers.GridServer; 165 IGridServer gridServer = GridServers.GridServer;
166 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); 166 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
167 167
168 if(!m_sandbox) { 168 if (!m_sandbox)
169 if(GridServers.GridServer.RequestConnection(regionData.SimUUID,regionData.IPListenAddr,(uint)regionData.IPListenPort)) { 169 {
170 m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!"); 170 if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort))
171 } else { 171 {
172 m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!"); 172 m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!");
173 m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!"); 173 }
174 Shutdown(); 174 else
175 } 175 {
176 176 m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!");
177 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); 177 m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!");
178 } 178 Shutdown();
179 }
180
181 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
182 }
179 183
180 LocalWorld.LoadPrimsFromStorage(); 184 LocalWorld.LoadPrimsFromStorage();
181 185
@@ -186,8 +190,8 @@ namespace OpenSim
186 190
187 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server"); 191 m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
188 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); 192 // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
189 193
190 BaseHttpServer httpServer = new BaseHttpServer( regionData.IPListenPort ); 194 BaseHttpServer httpServer = new BaseHttpServer(regionData.IPListenPort);
191 195
192 if (gridServer.GetName() == "Remote") 196 if (gridServer.GetName() == "Remote")
193 { 197 {
@@ -202,16 +206,17 @@ namespace OpenSim
202 agent_data.firstname = (string)requestData["firstname"]; 206 agent_data.firstname = (string)requestData["firstname"];
203 agent_data.lastname = (string)requestData["lastname"]; 207 agent_data.lastname = (string)requestData["lastname"];
204 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 208 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
205 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 209 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
206 if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) { 210 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
207 agent_data.child=true; 211 {
208 } 212 agent_data.child = true;
209 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 213 }
214 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
210 215
211 return new XmlRpcResponse(); 216 return new XmlRpcResponse();
212 }); 217 });
213 httpServer.AddRestHandler("GET", "/simstatus/", 218 httpServer.AddRestHandler("GET", "/simstatus/",
214 delegate(string request, string path, string param ) 219 delegate(string request, string path, string param)
215 { 220 {
216 return "OK"; 221 return "OK";
217 }); 222 });
@@ -302,52 +307,60 @@ namespace OpenSim
302 } 307 }
303 else if (packet.Type == PacketType.UseCircuitCode) 308 else if (packet.Type == PacketType.UseCircuitCode)
304 { // new client 309 { // new client
305 310
306 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 311 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
307 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 312 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
308 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox,((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child); 313 bool isChildAgent = false;
314 if (this.GridServers.GridServer.GetName() == "Remote")
315 {
316 isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child;
317 }
318 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent);
309 if ((this.GridServers.UserServer != null) && (user_accounts)) 319 if ((this.GridServers.UserServer != null) && (user_accounts))
310 { 320 {
311 newuser.UserServer = this.GridServers.UserServer; 321 newuser.UserServer = this.GridServers.UserServer;
312 } 322 }
313 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 323 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
314 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 324 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
315 325
316 if(!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) { 326 //if (!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child)
317 Hashtable SimParams; 327 if ((this.GridServers.GridServer.GetName() == "Remote") && (!isChildAgent))
318 ArrayList SendParams; 328 {
319 XmlRpcRequest GridReq; 329 Hashtable SimParams;
320 XmlRpcResponse GridResp; 330 ArrayList SendParams;
321 foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours) { 331 XmlRpcRequest GridReq;
322 m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]); 332 XmlRpcResponse GridResp;
323 SimParams = new Hashtable(); 333 foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours)
324 SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString(); 334 {
325 SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString(); 335 m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
326 SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname; 336 SimParams = new Hashtable();
327 SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname; 337 SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
328 SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString(); 338 SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
329 SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code; 339 SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
330 SimParams["child_agent"]="1"; 340 SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
331 SendParams = new ArrayList(); 341 SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
332 SendParams.Add(SimParams); 342 SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
333 343 SimParams["child_agent"] = "1";
334 GridReq = new XmlRpcRequest("expect_user", SendParams); 344 SendParams = new ArrayList();
335 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000); 345 SendParams.Add(SimParams);
336 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 346
337 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 347 GridReq = new XmlRpcRequest("expect_user", SendParams);
338 enablesimpacket.SimulatorInfo.Handle=Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); 348 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
339 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]); 349 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
340 byte[] byteIP = neighbourIP.GetAddressBytes(); 350 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
341 enablesimpacket.SimulatorInfo.IP=(uint)byteIP[3]<<24; 351 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
342 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[2]<<16; 352 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
343 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[1]<<8; 353 byte[] byteIP = neighbourIP.GetAddressBytes();
344 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[0]; 354 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
345 enablesimpacket.SimulatorInfo.Port=(ushort)Convert.ToInt32(neighbour["sim_port"]); 355 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
346 Thread.Sleep(3000); 356 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
347 _packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket); 357 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
348 } 358 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
349 } 359 Thread.Sleep(3000);
350 360 _packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket);
361 }
362 }
363
351 } 364 }
352 else 365 else
353 { // invalid client 366 { // invalid client