moved the EnableNeighbours code to after the client has completed the move to the region

zircon^2
MW 2007-05-14 21:04:14 +00:00
parent aaedfb5ae2
commit a889caf200
2 changed files with 42 additions and 36 deletions

View File

@ -543,42 +543,7 @@ namespace OpenSim
this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
//if (!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child)
if ((this.GridServers.GridServer.GetName() == "Remote") && (!isChildAgent))
{
Hashtable SimParams;
ArrayList SendParams;
XmlRpcRequest GridReq;
XmlRpcResponse GridResp;
foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours)
{
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"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);
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

View File

@ -368,6 +368,7 @@ namespace OpenSim
if (this.m_child) this.UpgradeClient();
ClientAvatar.CompleteMovement(m_world);
ClientAvatar.SendInitialPosition();
this.EnableNeighbours();
break;
case PacketType.RegionHandshakeReply:
m_world.SendLayerData(this);
@ -1147,5 +1148,45 @@ namespace OpenSim
//now should get other regions maps from gridserver
}
public void EnableNeighbours()
{
if ((this.m_gridServer.GetName() == "Remote") && (!this.m_child))
{
Hashtable SimParams;
ArrayList SendParams;
XmlRpcRequest GridReq;
XmlRpcResponse GridResp;
foreach (Hashtable neighbour in ((RemoteGridBase)this.m_gridServer).neighbours)
{
Console.WriteLine( "http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
SimParams = new Hashtable();
SimParams["session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SessionID.ToString();
SimParams["secure_session_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].SecureSessionID.ToString();
SimParams["firstname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].firstname;
SimParams["lastname"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].lastname;
SimParams["agent_id"] = ((RemoteGridBase)this.m_gridServer).agentcircuits[CircuitCode].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("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);
this.OutPacket(enablesimpacket);
}
}
}
}
}