diff options
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!
Diffstat (limited to 'Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs')
-rw-r--r-- | Common/OpenGrid.Framework.Communications/TestLocalCommsManager.cs | 35 |
1 files changed, 33 insertions, 2 deletions
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 | |||
26 | /// <returns></returns> | 26 | /// <returns></returns> |
27 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) | 27 | public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo) |
28 | { | 28 | { |
29 | //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); | ||
30 | |||
29 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) | 31 | if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) |
30 | { | 32 | { |
33 | //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); | ||
34 | |||
31 | this.regions.Add(regionInfo.RegionHandle, regionInfo); | 35 | this.regions.Add(regionInfo.RegionHandle, regionInfo); |
32 | RegionCommsHostBase regionHost = new RegionCommsHostBase(); | 36 | RegionCommsHostBase regionHost = new RegionCommsHostBase(); |
33 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); | 37 | this.regionHosts.Add(regionInfo.RegionHandle, regionHost); |
34 | 38 | ||
39 | |||
35 | return regionHost; | 40 | return regionHost; |
36 | } | 41 | } |
37 | 42 | ||
@@ -46,7 +51,26 @@ namespace OpenGrid.Framework.Communications | |||
46 | /// <returns></returns> | 51 | /// <returns></returns> |
47 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | 52 | public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) |
48 | { | 53 | { |
49 | return null; | 54 | // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); |
55 | List<RegionInfo> neighbours = new List<RegionInfo>(); | ||
56 | |||
57 | foreach (RegionInfo reg in this.regions.Values) | ||
58 | { | ||
59 | // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); | ||
60 | if (reg.RegionHandle != regionInfo.RegionHandle) | ||
61 | { | ||
62 | //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location"); | ||
63 | if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2))) | ||
64 | { | ||
65 | if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2))) | ||
66 | { | ||
67 | neighbours.Add(reg); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | return neighbours; | ||
50 | } | 74 | } |
51 | 75 | ||
52 | /// <summary> | 76 | /// <summary> |
@@ -55,6 +79,13 @@ namespace OpenGrid.Framework.Communications | |||
55 | /// <returns></returns> | 79 | /// <returns></returns> |
56 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData | 80 | public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData |
57 | { | 81 | { |
82 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | ||
83 | if (this.regionHosts.ContainsKey(regionHandle)) | ||
84 | { | ||
85 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
86 | this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); | ||
87 | return true; | ||
88 | } | ||
58 | return false; | 89 | return false; |
59 | } | 90 | } |
60 | 91 | ||
@@ -66,7 +97,7 @@ namespace OpenGrid.Framework.Communications | |||
66 | /// <returns></returns> | 97 | /// <returns></returns> |
67 | public bool AddNewSession(ulong regionHandle, Login loginData) | 98 | public bool AddNewSession(ulong regionHandle, Login loginData) |
68 | { | 99 | { |
69 | Console.WriteLine(" comms manager been told to expect new user"); | 100 | //Console.WriteLine(" comms manager been told to expect new user"); |
70 | AgentCircuitData agent = new AgentCircuitData(); | 101 | AgentCircuitData agent = new AgentCircuitData(); |
71 | agent.AgentID = loginData.Agent; | 102 | agent.AgentID = loginData.Agent; |
72 | agent.firstname = loginData.First; | 103 | agent.firstname = loginData.First; |