diff options
author | lbsa71 | 2007-09-25 06:33:18 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-25 06:33:18 +0000 |
commit | eb8640f368ab43b27395690404e845f09366c652 (patch) | |
tree | 736cca5f1e34fddfe1291046797547e4367afdb6 /OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |
parent | * Fixed Culture-variant parsing of config options (diff) | |
download | opensim-SC_OLD-eb8640f368ab43b27395690404e845f09366c652.zip opensim-SC_OLD-eb8640f368ab43b27395690404e845f09366c652.tar.gz opensim-SC_OLD-eb8640f368ab43b27395690404e845f09366c652.tar.bz2 opensim-SC_OLD-eb8640f368ab43b27395690404e845f09366c652.tar.xz |
* Now the OGS1GridServices has a LocalBackEndServices that it forwards intra-instance requests to
* Every Scene has a ClientManager (as every dog it's day) since two scenes can have the same circuit as client.
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 94 |
1 files changed, 29 insertions, 65 deletions
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; | |||
12 | using OpenSim.Framework.Console; | 12 | using OpenSim.Framework.Console; |
13 | using OpenSim.Framework.Servers; | 13 | using OpenSim.Framework.Servers; |
14 | using OpenSim.Framework.Types; | 14 | using OpenSim.Framework.Types; |
15 | using OpenSim.Region.Communications.Local; | ||
15 | 16 | ||
16 | namespace OpenSim.Region.Communications.OGS1 | 17 | namespace 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 |