After nearly a hour of searching for an annoying bug (which turned out to be a new statement one line outside the loop it should have been in)....Multi-Regions in a single instance work, there is no Grid mode communication, so it can only be tested in sandbox mode right now.

All you need to do is put .xml files for each region you want to be ran by the single server inside the "bin\Regions" folder (make sure none of the settings in those .xml files conflict with each other) and then startup the server and login, Any neighbouring regions that are being ran in the instance should show up.  (However there is still no movement or anything) 
Now time to refine the communications interfaces!
merge
MW 2007-05-31 17:33:52 +00:00
parent e92ab35b05
commit f4448fcd7d
5 changed files with 51 additions and 11 deletions

View File

@ -26,12 +26,17 @@ namespace OpenGrid.Framework.Communications
/// <returns></returns> /// <returns></returns>
public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
{ {
//Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
{ {
//Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
this.regions.Add(regionInfo.RegionHandle, regionInfo); this.regions.Add(regionInfo.RegionHandle, regionInfo);
RegionCommsHostBase regionHost = new RegionCommsHostBase(); RegionCommsHostBase regionHost = new RegionCommsHostBase();
this.regionHosts.Add(regionInfo.RegionHandle, regionHost); this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
return regionHost; return regionHost;
} }
@ -46,7 +51,26 @@ namespace OpenGrid.Framework.Communications
/// <returns></returns> /// <returns></returns>
public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
{ {
return null; // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
List<RegionInfo> neighbours = new List<RegionInfo>();
foreach (RegionInfo reg in this.regions.Values)
{
// Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
if (reg.RegionHandle != regionInfo.RegionHandle)
{
//Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
{
if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
{
neighbours.Add(reg);
}
}
}
}
return neighbours;
} }
/// <summary> /// <summary>
@ -55,6 +79,13 @@ namespace OpenGrid.Framework.Communications
/// <returns></returns> /// <returns></returns>
public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
{ {
//Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
if (this.regionHosts.ContainsKey(regionHandle))
{
// Console.WriteLine("CommsManager- Informing a region to expect child agent");
this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
return true;
}
return false; return false;
} }
@ -66,7 +97,7 @@ namespace OpenGrid.Framework.Communications
/// <returns></returns> /// <returns></returns>
public bool AddNewSession(ulong regionHandle, Login loginData) public bool AddNewSession(ulong regionHandle, Login loginData)
{ {
Console.WriteLine(" comms manager been told to expect new user"); //Console.WriteLine(" comms manager been told to expect new user");
AgentCircuitData agent = new AgentCircuitData(); AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = loginData.Agent; agent.AgentID = loginData.Agent;
agent.firstname = loginData.First; agent.firstname = loginData.First;

View File

@ -84,6 +84,7 @@ namespace OpenSim.Framework.Interfaces
void SendRegionHandshake(RegionInfo regionInfo); void SendRegionHandshake(RegionInfo regionInfo);
void MoveAgentIntoRegion(RegionInfo regInfo); void MoveAgentIntoRegion(RegionInfo regInfo);
void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos); void SendAvatarData(RegionInfo regionInfo, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos);
void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort);
AgentCircuitData RequestClientInfo(); AgentCircuitData RequestClientInfo();
} }
} }

View File

@ -374,7 +374,7 @@ namespace OpenSim
return objdata; return objdata;
} }
protected void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort) public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort)
{ {
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();

View File

@ -504,16 +504,22 @@ namespace OpenSim.world
/// </summary> /// </summary>
protected void InformClientOfNeighbours(IClientAPI remoteClient) protected void InformClientOfNeighbours(IClientAPI remoteClient)
{ {
// Console.WriteLine("informing client of neighbouring regions");
List<RegionInfo> neighbours = this.commsManager.RequestNeighbours(this.m_regInfo); List<RegionInfo> neighbours = this.commsManager.RequestNeighbours(this.m_regInfo);
//Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++) for (int i = 0; i < neighbours.Count; i++)
{ {
// Console.WriteLine("sending neighbours data");
AgentCircuitData agent = remoteClient.RequestClientInfo(); AgentCircuitData agent = remoteClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero; agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70); agent.startpos = new LLVector3(128, 128, 70);
this.commsManager.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent); this.commsManager.InformNeighbourOfChildAgent(neighbours[i].RegionHandle, agent);
remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].IPListenAddr), (ushort)neighbours[i].IPListenPort);
}
} }
} }

View File

@ -61,6 +61,7 @@ namespace OpenSim
private CheckSumServer checkServer; private CheckSumServer checkServer;
protected RegionServerCommsManager commsManager; protected RegionServerCommsManager commsManager;
public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile) public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool silent, string configFile)
{ {
this.configFileSetup = useConfigFile; this.configFileSetup = useConfigFile;
@ -209,6 +210,7 @@ namespace OpenSim
for (int i = 0; i < configFiles.Length; i++) for (int i = 0; i < configFiles.Length; i++)
{ {
regionDat = new RegionInfo();
if (m_sandbox) if (m_sandbox)
{ {
AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal(); AuthenticateSessionsLocal authen = new AuthenticateSessionsLocal();
@ -259,7 +261,7 @@ namespace OpenSim
protected override void SetupHttpListener() protected override void SetupHttpListener()
{ {
httpServer = new BaseHttpServer(regionData[0].IPListenPort); httpServer = new BaseHttpServer(9000); //regionData[0].IPListenPort);
if (!this.m_sandbox) if (!this.m_sandbox)
{ {