aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs79
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs94
2 files changed, 91 insertions, 82 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 3e23963..9a6bc82 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -30,14 +30,15 @@ using libsecondlife;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31using OpenSim.Framework.Communications;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using System.Collections;
33 34
34namespace OpenSim.Region.Communications.Local 35namespace OpenSim.Region.Communications.Local
35{ 36{
36 37
37 public class LocalBackEndServices : IGridServices, IInterRegionCommunications 38 public class LocalBackEndServices : IGridServices, IInterRegionCommunications
38 { 39 {
39 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>(); 40 protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
40 protected Dictionary<ulong, RegionCommsListener> regionHosts = new Dictionary<ulong, RegionCommsListener>(); 41 protected Dictionary<ulong, RegionCommsListener> m_regionListeners = new Dictionary<ulong, RegionCommsListener>();
41 42
42 public LocalBackEndServices() 43 public LocalBackEndServices()
43 { 44 {
@@ -52,12 +53,13 @@ namespace OpenSim.Region.Communications.Local
52 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 53 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
53 { 54 {
54 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering"); 55 //Console.WriteLine("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
55 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle)) 56 if (!this.m_regions.ContainsKey((uint)regionInfo.RegionHandle))
56 { 57 {
57 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle ); 58 //Console.WriteLine("CommsManager - Adding Region " + regionInfo.RegionHandle );
58 this.regions.Add(regionInfo.RegionHandle, regionInfo); 59 this.m_regions.Add(regionInfo.RegionHandle, regionInfo);
60
59 RegionCommsListener regionHost = new RegionCommsListener(); 61 RegionCommsListener regionHost = new RegionCommsListener();
60 this.regionHosts.Add(regionInfo.RegionHandle, regionHost); 62 this.m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
61 63
62 return regionHost; 64 return regionHost;
63 } 65 }
@@ -75,7 +77,7 @@ namespace OpenSim.Region.Communications.Local
75 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle); 77 // Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
76 List<RegionInfo> neighbours = new List<RegionInfo>(); 78 List<RegionInfo> neighbours = new List<RegionInfo>();
77 79
78 foreach (RegionInfo reg in this.regions.Values) 80 foreach (RegionInfo reg in this.m_regions.Values)
79 { 81 {
80 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY); 82 // Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
81 if (reg.RegionHandle != regionInfo.RegionHandle) 83 if (reg.RegionHandle != regionInfo.RegionHandle)
@@ -100,9 +102,9 @@ namespace OpenSim.Region.Communications.Local
100 /// <returns></returns> 102 /// <returns></returns>
101 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 103 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
102 { 104 {
103 if (this.regions.ContainsKey(regionHandle)) 105 if (this.m_regions.ContainsKey(regionHandle))
104 { 106 {
105 return this.regions[regionHandle]; 107 return this.m_regions[regionHandle];
106 } 108 }
107 return null; 109 return null;
108 } 110 }
@@ -118,7 +120,7 @@ namespace OpenSim.Region.Communications.Local
118 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 120 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
119 { 121 {
120 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 122 List<MapBlockData> mapBlocks = new List<MapBlockData>();
121 foreach(RegionInfo regInfo in this.regions.Values) 123 foreach(RegionInfo regInfo in this.m_regions.Values)
122 { 124 {
123 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY))) 125 if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) && ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
124 { 126 {
@@ -145,10 +147,10 @@ namespace OpenSim.Region.Communications.Local
145 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData 147 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) //should change from agentCircuitData
146 { 148 {
147 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); 149 //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent");
148 if (this.regionHosts.ContainsKey(regionHandle)) 150 if (this.m_regionListeners.ContainsKey(regionHandle))
149 { 151 {
150 // Console.WriteLine("CommsManager- Informing a region to expect child agent"); 152 // Console.WriteLine("CommsManager- Informing a region to expect child agent");
151 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agentData); 153 this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
152 return true; 154 return true;
153 } 155 }
154 return false; 156 return false;
@@ -163,18 +165,18 @@ namespace OpenSim.Region.Communications.Local
163 /// <returns></returns> 165 /// <returns></returns>
164 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 166 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
165 { 167 {
166 if (this.regionHosts.ContainsKey(regionHandle)) 168 if (this.m_regionListeners.ContainsKey(regionHandle))
167 { 169 {
168 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); 170 // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing");
169 this.regionHosts[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); 171 this.m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
170 return true; 172 return true;
171 } 173 }
172 return false; 174 return false;
173 } 175 }
174 176
175 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) 177 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
176 { 178 {
177 if (this.regionHosts.ContainsKey(regionHandle)) 179 if (this.m_regionListeners.ContainsKey(regionHandle))
178 { 180 {
179 return true; 181 return true;
180 } 182 }
@@ -201,11 +203,54 @@ namespace OpenSim.Region.Communications.Local
201 agent.startpos = new LLVector3(128, 128, 70); 203 agent.startpos = new LLVector3(128, 128, 70);
202 agent.CapsPath = loginData.CapsPath; 204 agent.CapsPath = loginData.CapsPath;
203 205
204 if (this.regionHosts.ContainsKey(regionHandle)) 206 TriggerExpectUser(regionHandle, agent);
207 }
208
209 public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
210 {
211 if (this.m_regionListeners.ContainsKey(regionHandle))
212 {
213 this.m_regionListeners[regionHandle].TriggerExpectUser(regionHandle, agent);
214 }
215 }
216
217 public void PingCheckReply(Hashtable respData)
218 {
219 foreach (ulong region in this.m_regions.Keys )
205 { 220 {
206 this.regionHosts[regionHandle].TriggerExpectUser(regionHandle, agent); 221 Hashtable regData = new Hashtable();
222 RegionInfo reg = m_regions[region];
223 regData["status"] = "active";
224 regData["handle"] = region.ToString();
225
226 respData[reg.SimUUID.ToStringHyphenated()] = regData;
207 } 227 }
208 } 228 }
229
230 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
231 {
232 if ( m_regionListeners.ContainsKey(regionHandle))
233 {
234 return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position,
235 isFlying);
236 }
237
238 return false;
239 }
240
241 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
242 {
243 if (m_regionListeners.ContainsKey(regionHandle))
244 {
245 TriggerExpectUser(regionHandle, agentData);
246 return true;
247 }
248
249 return false;
250 }
251
252
253
209 } 254 }
210} 255}
211 256
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 91694b5..1b4b54c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -12,13 +12,13 @@ using OpenSim.Framework.Communications;
12using OpenSim.Framework.Console; 12using OpenSim.Framework.Console;
13using OpenSim.Framework.Servers; 13using OpenSim.Framework.Servers;
14using OpenSim.Framework.Types; 14using OpenSim.Framework.Types;
15using OpenSim.Region.Communications.Local;
15 16
16namespace OpenSim.Region.Communications.OGS1 17namespace OpenSim.Region.Communications.OGS1
17{ 18{
18 public class OGS1GridServices : IGridServices, IInterRegionCommunications 19 public class OGS1GridServices : IGridServices, IInterRegionCommunications
19 { 20 {
20 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>(); 21 private LocalBackEndServices m_localBackend = new LocalBackEndServices();
21 protected Dictionary<ulong, RegionInfo> regions = new Dictionary<ulong, RegionInfo>();
22 22
23 public BaseHttpServer httpListener; 23 public BaseHttpServer httpListener;
24 public NetworkServersInfo serversInfo; 24 public NetworkServersInfo serversInfo;
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Communications.OGS1
35 httpServer = httpServe; 35 httpServer = httpServe;
36 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser); 36 httpServer.AddXmlRPCHandler("expect_user", this.ExpectUser);
37 httpServer.AddXmlRPCHandler("check", this.PingCheckReply); 37 httpServer.AddXmlRPCHandler("check", this.PingCheckReply);
38
38 this.StartRemoting(); 39 this.StartRemoting();
39 } 40 }
40 41
@@ -45,11 +46,6 @@ namespace OpenSim.Region.Communications.OGS1
45 /// <returns></returns> 46 /// <returns></returns>
46 public RegionCommsListener RegisterRegion(RegionInfo regionInfo) 47 public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
47 { 48 {
48 if (!this.regions.ContainsKey((uint)regionInfo.RegionHandle))
49 {
50 this.regions.Add(regionInfo.RegionHandle, regionInfo);
51 }
52
53 Hashtable GridParams = new Hashtable(); 49 Hashtable GridParams = new Hashtable();
54 // Login / Authentication 50 // Login / Authentication
55 51
@@ -83,18 +79,7 @@ namespace OpenSim.Region.Communications.OGS1
83 return null; 79 return null;
84 } 80 }
85 81
86 // Initialise the background listeners 82 return m_localBackend.RegisterRegion(regionInfo);
87 RegionCommsListener regListener = new RegionCommsListener();
88 if (!this.listeners.ContainsKey(regionInfo.RegionHandle))
89 {
90 this.listeners.Add(regionInfo.RegionHandle, regListener);
91 }
92 else
93 {
94 listeners[regionInfo.RegionHandle] = regListener;
95 }
96
97 return regListener;
98 } 83 }
99 84
100 /// <summary> 85 /// <summary>
@@ -133,7 +118,7 @@ namespace OpenSim.Region.Communications.OGS1
133 neighbour.RegionName = (string)neighbourData["name"]; 118 neighbour.RegionName = (string)neighbourData["name"];
134 119
135 //OGS1+ 120 //OGS1+
136 neighbour.SimUUID = new LLUUID((string) neighbourData["uuid"]); 121 neighbour.SimUUID = new LLUUID((string)neighbourData["uuid"]);
137 122
138 neighbours.Add(neighbour); 123 neighbours.Add(neighbour);
139 } 124 }
@@ -150,9 +135,11 @@ namespace OpenSim.Region.Communications.OGS1
150 /// <returns></returns> 135 /// <returns></returns>
151 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 136 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
152 { 137 {
153 if (this.regions.ContainsKey(regionHandle)) 138 RegionInfo regionInfo = m_localBackend.RequestNeighbourInfo(regionHandle);
139
140 if (regionInfo != null)
154 { 141 {
155 return this.regions[regionHandle]; 142 return regionInfo;
156 } 143 }
157 144
158 Hashtable requestData = new Hashtable(); 145 Hashtable requestData = new Hashtable();
@@ -179,7 +166,7 @@ namespace OpenSim.Region.Communications.OGS1
179 166
180 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); 167 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
181 string neighbourExternalUri = externalUri; 168 string neighbourExternalUri = externalUri;
182 RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); 169 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
183 170
184 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 171 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
185 regionInfo.RemotingAddress = internalIpStr; 172 regionInfo.RemotingAddress = internalIpStr;
@@ -245,7 +232,7 @@ namespace OpenSim.Region.Communications.OGS1
245 IList parameters = new ArrayList(); 232 IList parameters = new ArrayList();
246 parameters.Add(param); 233 parameters.Add(param);
247 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters); 234 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
248 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 3000); 235 XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000);
249 Hashtable respData = (Hashtable)resp.Value; 236 Hashtable respData = (Hashtable)resp.Value;
250 return respData; 237 return respData;
251 } 238 }
@@ -262,15 +249,7 @@ namespace OpenSim.Region.Communications.OGS1
262 Hashtable respData = new Hashtable(); 249 Hashtable respData = new Hashtable();
263 respData["online"] = "true"; 250 respData["online"] = "true";
264 251
265 foreach (ulong region in this.listeners.Keys) 252 m_localBackend.PingCheckReply(respData);
266 {
267 Hashtable regData = new Hashtable();
268 RegionInfo reg = regions[region];
269 regData["status"] = "active";
270 regData["handle"] = region.ToString();
271
272 respData[reg.SimUUID.ToStringHyphenated()] = regData;
273 }
274 253
275 response.Value = respData; 254 response.Value = respData;
276 255
@@ -308,14 +287,9 @@ namespace OpenSim.Region.Communications.OGS1
308 287
309 } 288 }
310 289
311 if (listeners.ContainsKey(Convert.ToUInt64((string)requestData["regionhandle"]))) 290 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
312 { 291
313 this.listeners[Convert.ToUInt64((string)requestData["regionhandle"])].TriggerExpectUser(Convert.ToUInt64((string)requestData["regionhandle"]), agentData); 292 m_localBackend.TriggerExpectUser(regionHandle, agentData);
314 }
315 else
316 {
317 MainLog.Instance.Error("ExpectUser() - Unknown region " + (Convert.ToUInt64(requestData["regionhandle"])).ToString());
318 }
319 293
320 MainLog.Instance.Verbose("ExpectUser() - Welcoming new user..."); 294 MainLog.Instance.Verbose("ExpectUser() - Welcoming new user...");
321 295
@@ -333,7 +307,7 @@ namespace OpenSim.Region.Communications.OGS1
333 307
334 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); 308 WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton);
335 RemotingConfiguration.RegisterWellKnownServiceType(wellType); 309 RemotingConfiguration.RegisterWellKnownServiceType(wellType);
336 InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; 310 InterRegionSingleton.Instance.OnArrival += this.TriggerExpectAvatarCrossing;
337 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; 311 InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent;
338 } 312 }
339 313
@@ -348,11 +322,11 @@ namespace OpenSim.Region.Communications.OGS1
348 { 322 {
349 try 323 try
350 { 324 {
351 if (this.listeners.ContainsKey(regionHandle)) 325 if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData))
352 { 326 {
353 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
354 return true; 327 return true;
355 } 328 }
329
356 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 330 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
357 if (regInfo != null) 331 if (regInfo != null)
358 { 332 {
@@ -401,11 +375,11 @@ namespace OpenSim.Region.Communications.OGS1
401 { 375 {
402 try 376 try
403 { 377 {
404 if (this.listeners.ContainsKey(regionHandle)) 378 if (m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying))
405 { 379 {
406 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
407 return true; 380 return true;
408 } 381 }
382
409 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle); 383 RegionInfo regInfo = this.RequestNeighbourInfo(regionHandle);
410 if (regInfo != null) 384 if (regInfo != null)
411 { 385 {
@@ -440,14 +414,11 @@ namespace OpenSim.Region.Communications.OGS1
440 } 414 }
441 } 415 }
442 416
443 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentID) 417 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
444 { 418 {
445 if (this.listeners.ContainsKey(regionHandle)) 419 return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId);
446 {
447 return true;
448 }
449 return false;
450 } 420 }
421
451 #endregion 422 #endregion
452 423
453 #region Methods triggered by calls from external instances 424 #region Methods triggered by calls from external instances
@@ -461,17 +432,13 @@ namespace OpenSim.Region.Communications.OGS1
461 { 432 {
462 try 433 try
463 { 434 {
464 if (this.listeners.ContainsKey(regionHandle)) 435 return m_localBackend.IncomingChildAgent(regionHandle, agentData);
465 {
466 this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData);
467 return true;
468 }
469 } 436 }
470 catch (System.Runtime.Remoting.RemotingException e) 437 catch (System.Runtime.Remoting.RemotingException e)
471 { 438 {
472 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 439 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
440 return false;
473 } 441 }
474 return false;
475 } 442 }
476 443
477 /// <summary> 444 /// <summary>
@@ -481,21 +448,18 @@ namespace OpenSim.Region.Communications.OGS1
481 /// <param name="agentID"></param> 448 /// <param name="agentID"></param>
482 /// <param name="position"></param> 449 /// <param name="position"></param>
483 /// <returns></returns> 450 /// <returns></returns>
484 public bool IncomingArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 451 public bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
485 { 452 {
453
486 try 454 try
487 { 455 {
488 if (this.listeners.ContainsKey(regionHandle)) 456 return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
489 {
490 this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying);
491 return true;
492 }
493 } 457 }
494 catch (System.Runtime.Remoting.RemotingException e) 458 catch (System.Runtime.Remoting.RemotingException e)
495 { 459 {
496 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 460 MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
461 return false;
497 } 462 }
498 return false;
499 } 463 }
500 #endregion 464 #endregion
501 #endregion 465 #endregion