diff options
author | Justin Clark-Casey (justincc) | 2013-09-02 17:27:45 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-09-04 00:46:26 +0100 |
commit | 8b7bcc8346f5f2a163278c5f5a15613c9b44a551 (patch) | |
tree | e57f88a7f7fd2021097f1fbc93e8e620cace92fe /OpenSim/Services | |
parent | Fix exception thrown after a region has been restarted through scheduling. (diff) | |
download | opensim-SC_OLD-8b7bcc8346f5f2a163278c5f5a15613c9b44a551.zip opensim-SC_OLD-8b7bcc8346f5f2a163278c5f5a15613c9b44a551.tar.gz opensim-SC_OLD-8b7bcc8346f5f2a163278c5f5a15613c9b44a551.tar.bz2 opensim-SC_OLD-8b7bcc8346f5f2a163278c5f5a15613c9b44a551.tar.xz |
Allow one to specify a DefaultHGRegion flag in [GridService] in order to allow different default regions for HG and direct grid logins.
This requires a new GridService.GetDefaultHypergridRegions() so ROBUST services require updating but not simulators.
This method still returns regions flagged with just DefaultRegion after any DefaultHGRegions, so if no DefaultHGRegions are specified
then existing configured defaults will still work.
Immediate use is for conference where we need to be able to specify different defaults
However, this is also generally useful to send experienced HG users to one default location and local users whose specified region fails (e.g. no "home" or "last") to another.
Diffstat (limited to 'OpenSim/Services')
6 files changed, 90 insertions, 4 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 34ed0d7..0f5a613 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -515,6 +515,57 @@ namespace OpenSim.Services.Connectors | |||
515 | return rinfos; | 515 | return rinfos; |
516 | } | 516 | } |
517 | 517 | ||
518 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
519 | { | ||
520 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
521 | |||
522 | sendData["SCOPEID"] = scopeID.ToString(); | ||
523 | |||
524 | sendData["METHOD"] = "get_default_hypergrid_regions"; | ||
525 | |||
526 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
527 | string reply = string.Empty; | ||
528 | string uri = m_ServerURI + "/grid"; | ||
529 | try | ||
530 | { | ||
531 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
532 | uri, | ||
533 | ServerUtils.BuildQueryString(sendData)); | ||
534 | |||
535 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
536 | } | ||
537 | catch (Exception e) | ||
538 | { | ||
539 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
540 | return rinfos; | ||
541 | } | ||
542 | |||
543 | if (reply != string.Empty) | ||
544 | { | ||
545 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
546 | |||
547 | if (replyData != null) | ||
548 | { | ||
549 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
550 | foreach (object r in rinfosList) | ||
551 | { | ||
552 | if (r is Dictionary<string, object>) | ||
553 | { | ||
554 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
555 | rinfos.Add(rinfo); | ||
556 | } | ||
557 | } | ||
558 | } | ||
559 | else | ||
560 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions {0} received null response", | ||
561 | scopeID); | ||
562 | } | ||
563 | else | ||
564 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions received null reply"); | ||
565 | |||
566 | return rinfos; | ||
567 | } | ||
568 | |||
518 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 569 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
519 | { | 570 | { |
520 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 571 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index bcc1e4a..816591b 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -330,6 +330,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
330 | return new List<GridRegion>(0); | 330 | return new List<GridRegion>(0); |
331 | } | 331 | } |
332 | 332 | ||
333 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
334 | { | ||
335 | // TODO: Allow specifying the default grid location | ||
336 | return GetDefaultRegions(scopeID); | ||
337 | } | ||
338 | |||
333 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 339 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
334 | { | 340 | { |
335 | GridRegion defRegion = GetNearestRegion(new Vector3d(x, y, 0.0), true); | 341 | GridRegion defRegion = GetNearestRegion(new Vector3d(x, y, 0.0), true); |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a1485c8..e72b7f9 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -265,8 +265,9 @@ namespace OpenSim.Services.GridService | |||
265 | m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); | 265 | m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); |
266 | } | 266 | } |
267 | 267 | ||
268 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", | 268 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3} with flags {4}", |
269 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY); | 269 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY, |
270 | (OpenSim.Framework.RegionFlags)flags); | ||
270 | 271 | ||
271 | return String.Empty; | 272 | return String.Empty; |
272 | } | 273 | } |
@@ -478,6 +479,33 @@ namespace OpenSim.Services.GridService | |||
478 | return ret; | 479 | return ret; |
479 | } | 480 | } |
480 | 481 | ||
482 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
483 | { | ||
484 | List<GridRegion> ret = new List<GridRegion>(); | ||
485 | |||
486 | List<RegionData> regions = m_Database.GetDefaultHypergridRegions(scopeID); | ||
487 | |||
488 | foreach (RegionData r in regions) | ||
489 | { | ||
490 | if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) | ||
491 | ret.Add(RegionData2RegionInfo(r)); | ||
492 | } | ||
493 | |||
494 | int hgDefaultRegionsFoundOnline = regions.Count; | ||
495 | |||
496 | // For now, hypergrid default regions will always be given precedence but we will also return simple default | ||
497 | // regions in case no specific hypergrid regions are specified. | ||
498 | ret.AddRange(GetDefaultRegions(scopeID)); | ||
499 | |||
500 | int normalDefaultRegionsFoundOnline = ret.Count - hgDefaultRegionsFoundOnline; | ||
501 | |||
502 | m_log.DebugFormat( | ||
503 | "[GRID SERVICE]: GetDefaultHypergridRegions returning {0} hypergrid default and {1} normal default regions", | ||
504 | hgDefaultRegionsFoundOnline, normalDefaultRegionsFoundOnline); | ||
505 | |||
506 | return ret; | ||
507 | } | ||
508 | |||
481 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 509 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
482 | { | 510 | { |
483 | List<GridRegion> ret = new List<GridRegion>(); | 511 | List<GridRegion> ret = new List<GridRegion>(); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 8335724..4024295 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Services.GridService | |||
79 | { | 79 | { |
80 | if (m_DefaultRegion == null) | 80 | if (m_DefaultRegion == null) |
81 | { | 81 | { |
82 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); | 82 | List<GridRegion> defs = m_GridService.GetDefaultHypergridRegions(m_ScopeID); |
83 | if (defs != null && defs.Count > 0) | 83 | if (defs != null && defs.Count > 0) |
84 | m_DefaultRegion = defs[0]; | 84 | m_DefaultRegion = defs[0]; |
85 | else | 85 | else |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index e10c4cb..f6136b5 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -171,7 +171,7 @@ namespace OpenSim.Services.HypergridService | |||
171 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); | 171 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); |
172 | if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) | 172 | if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) |
173 | { | 173 | { |
174 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); | 174 | List<GridRegion> defs = m_GridService.GetDefaultHypergridRegions(m_ScopeID); |
175 | if (defs != null && defs.Count > 0) | 175 | if (defs != null && defs.Count > 0) |
176 | { | 176 | { |
177 | region = defs[0]; | 177 | region = defs[0]; |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index d7da056..5528d7e 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -97,6 +97,7 @@ namespace OpenSim.Services.Interfaces | |||
97 | List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); | 97 | List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); |
98 | 98 | ||
99 | List<GridRegion> GetDefaultRegions(UUID scopeID); | 99 | List<GridRegion> GetDefaultRegions(UUID scopeID); |
100 | List<GridRegion> GetDefaultHypergridRegions(UUID scopeID); | ||
100 | List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); | 101 | List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); |
101 | List<GridRegion> GetHyperlinks(UUID scopeID); | 102 | List<GridRegion> GetHyperlinks(UUID scopeID); |
102 | 103 | ||