aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs
diff options
context:
space:
mode:
authorMW2007-06-10 18:51:45 +0000
committerMW2007-06-10 18:51:45 +0000
commit453fadd94071545b76706674bb284402c9a065c0 (patch)
treee971a1970f5926da1a9393b94f9b3e109a8cd14b /Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs
parentAdded a Couple of summary comments (diff)
downloadopensim-SC-453fadd94071545b76706674bb284402c9a065c0.zip
opensim-SC-453fadd94071545b76706674bb284402c9a065c0.tar.gz
opensim-SC-453fadd94071545b76706674bb284402c9a065c0.tar.bz2
opensim-SC-453fadd94071545b76706674bb284402c9a065c0.tar.xz
Added SandBoxManager which in sandbox mode, acts as the backend server for the CommsManager interfaces (commsManager.gridServer etc).
Diffstat (limited to '')
-rw-r--r--Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs101
1 files changed, 3 insertions, 98 deletions
diff --git a/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs
index fcccb49..bfcd15f 100644
--- a/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs
+++ b/Common/OpenGrid.Framework.Communications/RegionServerCommsLocal.cs
@@ -11,117 +11,22 @@ namespace OpenGrid.Framework.Communications
11{ 11{
12 public class RegionServerCommsLocal : RegionServerCommsManager 12 public class RegionServerCommsLocal : RegionServerCommsManager
13 { 13 {
14 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); 14 public SandBoxManager SandManager = new SandBoxManager();
15 protected Dictionary<ulong, RegionCommsHostBase> regionHosts = new Dictionary<ulong, RegionCommsHostBase>();
16
17 public RegionServerCommsLocal() 15 public RegionServerCommsLocal()
18 { 16 {
19 userServer = new UserServer.UserCommsManagerLocal(); //Local User Server 17 userServer = new UserServer.UserCommsManagerLocal(); //Local User Server
20 gridServer = new GridServer.GridCommsManagerLocal(); //Locl Grid Server 18 gridServer = new GridServer.GridCommsManagerLocal(SandManager); //Locl Grid Server
21 }
22
23 /// <summary>
24 /// Main Register a region method with the CommsManager.
25 /// Should do anything that is needed and also call the RegisterRegion method in the gridserver class
26 /// to inform the grid server (in grid mode).
27 /// </summary>
28 /// <param name="regionInfo"></param>
29 /// <returns></returns>
30 public override RegionCommsHostBase RegisterRegion(RegionInfo regionInfo)
31 {
32 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
33 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
34 {
35 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
36 this.regions.Add(regionInfo.RegionHandle, regionInfo);
37 RegionCommsHostBase regionHost = new RegionCommsHostBase();
38 this.regionHosts.Add(regionInfo.RegionHandle, regionHost);
39
40 return regionHost;
41 }
42
43 //already in our list of regions so for now lets return null
44 return null;
45 }
46
47 /// <summary>
48 /// In the current class structure this shouldn't be here as it should only be in the gridserver class
49 /// but having it there in sandbox mode makes things very difficult, so for now until something is sorted out
50 /// it will have to be here as well
51 /// </summary>
52 /// <param name="regionInfo"></param>
53 /// <returns></returns>
54 public override List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
55 {
56 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
57 List<RegionInfo> neighbours = new List<RegionInfo>();
58
59 foreach (RegionInfo reg in this.regions.Values)
60 {
61 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
62 if (reg.RegionHandle != regionInfo.RegionHandle)
63 {
64 //Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
65 if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
66 {
67 if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
68 {
69 neighbours.Add(reg);
70 }
71 }
72 }
73 }
74 return neighbours;
75 } 19 }
76 20
77 /// <summary> 21 /// <summary>
78 /// informs a neighbouring sim to expect a child agent 22 /// informs a neighbouring sim to expect a child agent
79 /// I guess if we are going to stick with the current class structure then we need a intersim class
80 /// but think we need to really rethink the class structure as currently it makes things very messy for sandbox mode
81 /// </summary> 23 /// </summary>
82 /// <param name="regionHandle"></param> 24 /// <param name="regionHandle"></param>
83 /// <param name="agentData"></param> 25 /// <param name="agentData"></param>
84 /// <returns></returns> 26 /// <returns></returns>
85 public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData 27 public override bool InformNeighbourOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
86 { 28 {
87 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); 29 return SandManager.InformNeighbourOfChildAgent(regionHandle, agentData);
88 if (this.regionHosts.ContainsKey(regionHandle))
89 {
90 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
91 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData);
92 return true;
93 }
94 return false;
95 }
96
97 /// <summary>
98 /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
99 /// </summary>
100 /// <param name="regionHandle"></param>
101 /// <param name="loginData"></param>
102 /// <returns></returns>
103 public bool AddNewSession(ulong regionHandle, Login loginData)
104 {
105 //Console.WriteLine(" comms manager been told to expect new user");
106 AgentCircuitData agent = new AgentCircuitData();
107 agent.AgentID = loginData.Agent;
108 agent.firstname = loginData.First;
109 agent.lastname = loginData.Last;
110 agent.SessionID = loginData.Session;
111 agent.SecureSessionID = loginData.SecureSession;
112 agent.circuitcode = loginData.CircuitCode;
113 agent.BaseFolder = loginData.BaseFolder;
114 agent.InventoryFolder = loginData.InventoryFolder;
115 agent.startpos = new LLVector3(128, 128, 70);
116
117 if (this.regionHosts.ContainsKey(regionHandle))
118 {
119 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent);
120 return true;
121 }
122
123 // region not found
124 return false;
125 } 30 }
126 } 31 }
127} 32}