From 9fcffee76b3e029838c24c5a2d2a3da3be19dedf Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 24 May 2007 02:36:07 +0000 Subject: * Simulators should no longer require all their neighbours to be online to accept user connections. --- OpenSim.RegionServer/ClientView.Grid.cs | 71 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 32 deletions(-) (limited to 'OpenSim.RegionServer') diff --git a/OpenSim.RegionServer/ClientView.Grid.cs b/OpenSim.RegionServer/ClientView.Grid.cs index a3b191c..5229dbd 100644 --- a/OpenSim.RegionServer/ClientView.Grid.cs +++ b/OpenSim.RegionServer/ClientView.Grid.cs @@ -35,38 +35,45 @@ namespace OpenSim foreach (Hashtable neighbour in gridServer.neighbours) { - string neighbourIPStr = (string)neighbour["sim_ip"]; - System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); - ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); - string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); - - Console.WriteLine(reqUrl); - - SimParams = new Hashtable(); - SimParams["session_id"] = this.SessionID.ToString(); - SimParams["secure_session_id"] = this.SecureSessionID.ToString(); - SimParams["firstname"] = this.ClientAvatar.firstname; - SimParams["lastname"] = this.ClientAvatar.lastname; - SimParams["agent_id"] = this.AgentID.ToString(); - SimParams["circuit_code"] = (Int32)this.CircuitCode; - SimParams["child_agent"] = "1"; - SendParams = new ArrayList(); - SendParams.Add(SimParams); - - GridReq = new XmlRpcRequest("expect_user", SendParams); - GridResp = GridReq.Send(reqUrl, 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)); - - - 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 = neighbourPort; - enablePackets.Add(enablesimpacket); + try + { + string neighbourIPStr = (string)neighbour["sim_ip"]; + System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse(neighbourIPStr); + ushort neighbourPort = (ushort)Convert.ToInt32(neighbour["sim_port"]); + string reqUrl = "http://" + neighbourIPStr + ":" + neighbourPort.ToString(); + + Console.WriteLine(reqUrl); + + SimParams = new Hashtable(); + SimParams["session_id"] = this.SessionID.ToString(); + SimParams["secure_session_id"] = this.SecureSessionID.ToString(); + SimParams["firstname"] = this.ClientAvatar.firstname; + SimParams["lastname"] = this.ClientAvatar.lastname; + SimParams["agent_id"] = this.AgentID.ToString(); + SimParams["circuit_code"] = (Int32)this.CircuitCode; + SimParams["child_agent"] = "1"; + SendParams = new ArrayList(); + SendParams.Add(SimParams); + + GridReq = new XmlRpcRequest("expect_user", SendParams); + GridResp = GridReq.Send(reqUrl, 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)); + + + 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 = neighbourPort; + enablePackets.Add(enablesimpacket); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); + } } Thread.Sleep(3000); foreach (Packet enable in enablePackets) -- cgit v1.1