aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/SimClient.Grid.cs
diff options
context:
space:
mode:
authorlbsa712007-05-17 12:47:45 +0000
committerlbsa712007-05-17 12:47:45 +0000
commit51581dba75ef438d71679ac6a81ef7938f41fbc0 (patch)
tree891e066140950dd6c3962401edcf9e421aea895d /OpenSim.RegionServer/SimClient.Grid.cs
parentCheck it builds before you commit (diff)
downloadopensim-SC_OLD-51581dba75ef438d71679ac6a81ef7938f41fbc0.zip
opensim-SC_OLD-51581dba75ef438d71679ac6a81ef7938f41fbc0.tar.gz
opensim-SC_OLD-51581dba75ef438d71679ac6a81ef7938f41fbc0.tar.bz2
opensim-SC_OLD-51581dba75ef438d71679ac6a81ef7938f41fbc0.tar.xz
* refactored a bit and added error msg
Diffstat (limited to 'OpenSim.RegionServer/SimClient.Grid.cs')
-rw-r--r--OpenSim.RegionServer/SimClient.Grid.cs76
1 files changed, 45 insertions, 31 deletions
diff --git a/OpenSim.RegionServer/SimClient.Grid.cs b/OpenSim.RegionServer/SimClient.Grid.cs
index b0d59cc..3ae419a 100644
--- a/OpenSim.RegionServer/SimClient.Grid.cs
+++ b/OpenSim.RegionServer/SimClient.Grid.cs
@@ -30,40 +30,54 @@ namespace OpenSim
30 XmlRpcRequest GridReq; 30 XmlRpcRequest GridReq;
31 XmlRpcResponse GridResp; 31 XmlRpcResponse GridResp;
32 List<Packet> enablePackets = new List<Packet>(); 32 List<Packet> enablePackets = new List<Packet>();
33 foreach (Hashtable neighbour in ((RemoteGridBase)this.m_gridServer).neighbours)
34 {
35 Console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
36 SimParams = new Hashtable();
37 SimParams["session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SessionID.ToString();
38 SimParams["secure_session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SecureSessionID.ToString();
39 SimParams["firstname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].firstname;
40 SimParams["lastname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].lastname;
41 SimParams["agent_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].AgentID.ToString();
42 SimParams["circuit_code"] = (Int32)this.CircuitCode;
43 SimParams["child_agent"] = "1";
44 SendParams = new ArrayList();
45 SendParams.Add(SimParams);
46 33
47 GridReq = new XmlRpcRequest("expect_user", SendParams); 34 RemoteGridBase gridServer = (RemoteGridBase)this.m_gridServer;
48 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000); 35
49 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 36 Dictionary<uint, AgentCircuitData> agentCircuits = gridServer.agentcircuits;
50 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 37 AgentCircuitData agentCircuit;
51 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256)); 38
52 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]); 39 if (agentCircuits.TryGetValue(CircuitCode, out agentCircuit))
53 byte[] byteIP = neighbourIP.GetAddressBytes();
54 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
55 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
56 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
57 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
58 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
59 enablePackets.Add(enablesimpacket);
60 }
61 Thread.Sleep(3000);
62 foreach (Packet enable in enablePackets)
63 { 40 {
64 this.OutPacket(enable); 41
42 foreach (Hashtable neighbour in gridServer.neighbours)
43 {
44 Console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
45 SimParams = new Hashtable();
46 SimParams["session_id"] = agentCircuit.SessionID.ToString();
47 SimParams["secure_session_id"] = agentCircuit.SecureSessionID.ToString();
48 SimParams["firstname"] = agentCircuit.firstname;
49 SimParams["lastname"] = agentCircuit.lastname;
50 SimParams["agent_id"] = agentCircuit.AgentID.ToString();
51 SimParams["circuit_code"] = (Int32)this.CircuitCode;
52 SimParams["child_agent"] = "1";
53 SendParams = new ArrayList();
54 SendParams.Add(SimParams);
55
56 GridReq = new XmlRpcRequest("expect_user", SendParams);
57 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
58 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
59 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
60 enablesimpacket.SimulatorInfo.Handle = Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
61 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
62 byte[] byteIP = neighbourIP.GetAddressBytes();
63 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
64 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
65 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
66 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
67 enablesimpacket.SimulatorInfo.Port = (ushort)Convert.ToInt32(neighbour["sim_port"]);
68 enablePackets.Add(enablesimpacket);
69 }
70 Thread.Sleep(3000);
71 foreach (Packet enable in enablePackets)
72 {
73 this.OutPacket(enable);
74 }
75 enablePackets.Clear();
65 } 76 }
66 enablePackets.Clear(); 77 }
78 else
79 {
80 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "SimClient.cs: Couldn't find AgentCircuit for CircuitCode {0}.", CircuitCode );
67 } 81 }
68 } 82 }
69 83