From f4448fcd7df587604b63e45fc5bcdbaec3f579ee Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 31 May 2007 17:33:52 +0000 Subject: 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! --- .../TestLocalCommsManager.cs | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'Common/OpenGrid.Framework.Communications') diff --git a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs index 54ca966..c82c820 100644 --- a/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs @@ -26,12 +26,17 @@ namespace OpenGrid.Framework.Communications /// 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)) { + //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); + this.regions.Add(regionInfo.RegionHandle, regionInfo); RegionCommsHostBase regionHost = new RegionCommsHostBase(); this.regionHosts.Add(regionInfo.RegionHandle, regionHost); + return regionHost; } @@ -46,7 +51,26 @@ namespace OpenGrid.Framework.Communications /// public override List RequestNeighbours(RegionInfo regionInfo) { - return null; + // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); + List neighbours = new List(); + + 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; } /// @@ -55,6 +79,13 @@ namespace OpenGrid.Framework.Communications /// 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; } @@ -66,7 +97,7 @@ namespace OpenGrid.Framework.Communications /// 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(); agent.AgentID = loginData.Agent; agent.firstname = loginData.First; -- cgit v1.1