Started to fix sandbox mode

0.1-prestable
MW 2007-04-15 09:45:34 +00:00
parent 7f0ecec464
commit 990680027f
1 changed files with 71 additions and 58 deletions

View File

@ -48,7 +48,7 @@ using OpenSim.Framework.Console;
using OpenSim.Physics.Manager; using OpenSim.Physics.Manager;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Servers; using OpenSim.Servers;
using OpenSim.GenericConfig; using OpenSim.GenericConfig;
namespace OpenSim namespace OpenSim
{ {
@ -164,18 +164,22 @@ namespace OpenSim
GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
IGridServer gridServer = GridServers.GridServer; IGridServer gridServer = GridServers.GridServer;
gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
if(!m_sandbox) { if (!m_sandbox)
if(GridServers.GridServer.RequestConnection(regionData.SimUUID,regionData.IPListenAddr,(uint)regionData.IPListenPort)) { {
m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!"); if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort))
} else { {
m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!"); m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!");
m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!"); }
Shutdown(); else
} {
m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!");
GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!");
} Shutdown();
}
GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
}
LocalWorld.LoadPrimsFromStorage(); LocalWorld.LoadPrimsFromStorage();
@ -186,8 +190,8 @@ namespace OpenSim
m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server"); m_console.WriteLine("Main.cs:Startup() - Initialising HTTP server");
// HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort);
BaseHttpServer httpServer = new BaseHttpServer( regionData.IPListenPort ); BaseHttpServer httpServer = new BaseHttpServer(regionData.IPListenPort);
if (gridServer.GetName() == "Remote") if (gridServer.GetName() == "Remote")
{ {
@ -202,16 +206,17 @@ namespace OpenSim
agent_data.firstname = (string)requestData["firstname"]; agent_data.firstname = (string)requestData["firstname"];
agent_data.lastname = (string)requestData["lastname"]; agent_data.lastname = (string)requestData["lastname"];
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) { if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
agent_data.child=true; {
} agent_data.child = true;
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); }
((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
return new XmlRpcResponse(); return new XmlRpcResponse();
}); });
httpServer.AddRestHandler("GET", "/simstatus/", httpServer.AddRestHandler("GET", "/simstatus/",
delegate(string request, string path, string param ) delegate(string request, string path, string param)
{ {
return "OK"; return "OK";
}); });
@ -302,52 +307,60 @@ namespace OpenSim
} }
else if (packet.Type == PacketType.UseCircuitCode) else if (packet.Type == PacketType.UseCircuitCode)
{ // new client { // new client
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
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); bool isChildAgent = false;
if (this.GridServers.GridServer.GetName() == "Remote")
{
isChildAgent = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child;
}
SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox, isChildAgent);
if ((this.GridServers.UserServer != null) && (user_accounts)) if ((this.GridServers.UserServer != null) && (user_accounts))
{ {
newuser.UserServer = this.GridServers.UserServer; newuser.UserServer = this.GridServers.UserServer;
} }
//OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
if(!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) {
Hashtable SimParams;
ArrayList SendParams;
XmlRpcRequest GridReq;
XmlRpcResponse GridResp;
foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours) {
m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
SimParams = new Hashtable();
SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
SimParams["child_agent"]="1";
SendParams = new ArrayList();
SendParams.Add(SimParams);
GridReq = new XmlRpcRequest("expect_user", SendParams); //if (!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child)
GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000); if ((this.GridServers.GridServer.GetName() == "Remote") && (!isChildAgent))
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); {
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); Hashtable SimParams;
enablesimpacket.SimulatorInfo.Handle=Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); ArrayList SendParams;
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]); XmlRpcRequest GridReq;
byte[] byteIP = neighbourIP.GetAddressBytes(); XmlRpcResponse GridResp;
enablesimpacket.SimulatorInfo.IP=(uint)byteIP[3]<<24; foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours)
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[2]<<16; {
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[1]<<8; m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[0]; SimParams = new Hashtable();
enablesimpacket.SimulatorInfo.Port=(ushort)Convert.ToInt32(neighbour["sim_port"]); SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
Thread.Sleep(3000); SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
_packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket); SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
} SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
} SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
SimParams["child_agent"] = "1";
SendParams = new ArrayList();
SendParams.Add(SimParams);
GridReq = new XmlRpcRequest("expect_user", SendParams);
GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
byte[] byteIP = neighbourIP.GetAddressBytes();
enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
Thread.Sleep(3000);
_packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket);
}
}
} }
else else
{ // invalid client { // invalid client