aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/OpenSimMain.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs61
1 files changed, 56 insertions, 5 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 8c93128..f10ca34 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,6 +164,18 @@ 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
168 if(!m_sandbox) {
169 if(GridServers.GridServer.RequestConnection(regionData.SimUUID,regionData.IPListenAddr,(uint)regionData.IPListenPort)) {
170 m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!");
171 } else {
172 m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!");
173 m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!");
174 Shutdown();
175 }
176 }
177
178 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
167 179
168 LocalWorld.LoadPrimsFromStorage(); 180 LocalWorld.LoadPrimsFromStorage();
169 181
@@ -190,9 +202,11 @@ namespace OpenSim
190 agent_data.firstname = (string)requestData["firstname"]; 202 agent_data.firstname = (string)requestData["firstname"];
191 agent_data.lastname = (string)requestData["lastname"]; 203 agent_data.lastname = (string)requestData["lastname"];
192 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 204 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
193 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 205 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
194 206 if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) {
195 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 207 agent_data.child=true;
208 }
209 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
196 210
197 return new XmlRpcResponse(); 211 return new XmlRpcResponse();
198 }); 212 });
@@ -288,15 +302,52 @@ namespace OpenSim
288 } 302 }
289 else if (packet.Type == PacketType.UseCircuitCode) 303 else if (packet.Type == PacketType.UseCircuitCode)
290 { // new client 304 { // new client
305
291 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 306 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
292 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 307 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
293 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox); 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);
294 if ((this.GridServers.UserServer != null) && (user_accounts)) 309 if ((this.GridServers.UserServer != null) && (user_accounts))
295 { 310 {
296 newuser.UserServer = this.GridServers.UserServer; 311 newuser.UserServer = this.GridServers.UserServer;
297 } 312 }
298 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 313 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
299 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 314 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
315
316 if(!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) {
317 Hashtable SimParams;
318 ArrayList SendParams;
319 XmlRpcRequest GridReq;
320 XmlRpcResponse GridResp;
321 foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours) {
322 m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
323 SimParams = new Hashtable();
324 SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
325 SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
326 SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
327 SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
328 SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
329 SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
330 SimParams["child_agent"]="1";
331 SendParams = new ArrayList();
332 SendParams.Add(SimParams);
333
334 GridReq = new XmlRpcRequest("expect_user", SendParams);
335 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
336 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
337 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
338 enablesimpacket.SimulatorInfo.Handle=Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
339 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
340 byte[] byteIP = neighbourIP.GetAddressBytes();
341 enablesimpacket.SimulatorInfo.IP=(uint)byteIP[3]<<24;
342 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[2]<<16;
343 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[1]<<8;
344 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[0];
345 enablesimpacket.SimulatorInfo.Port=(ushort)Convert.ToInt32(neighbour["sim_port"]);
346 Thread.Sleep(3000);
347 _packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket);
348 }
349 }
350
300 } 351 }
301 else 352 else
302 { // invalid client 353 { // invalid client