aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs85
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs2
2 files changed, 58 insertions, 29 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index daebf8b..e72b7f9 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService
86 { 86 {
87 MainConsole.Instance.Commands.AddCommand("Regions", true, 87 MainConsole.Instance.Commands.AddCommand("Regions", true,
88 "deregister region id", 88 "deregister region id",
89 "deregister region id <Region UUID>", 89 "deregister region id <region-id>+",
90 "Deregister a region manually.", 90 "Deregister a region manually.",
91 String.Empty, 91 String.Empty,
92 HandleDeregisterRegion); 92 HandleDeregisterRegion);
@@ -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>();
@@ -526,40 +554,41 @@ namespace OpenSim.Services.GridService
526 554
527 private void HandleDeregisterRegion(string module, string[] cmd) 555 private void HandleDeregisterRegion(string module, string[] cmd)
528 { 556 {
529 if (cmd.Length != 4) 557 if (cmd.Length < 4)
530 { 558 {
531 MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>"); 559 MainConsole.Instance.Output("Usage: degregister region id <region-id>+");
532 return; 560 return;
533 } 561 }
534 562
535 string rawRegionUuid = cmd[3]; 563 for (int i = 3; i < cmd.Length; i++)
536 UUID regionUuid;
537
538 if (!UUID.TryParse(rawRegionUuid, out regionUuid))
539 { 564 {
540 MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); 565 string rawRegionUuid = cmd[i];
541 return; 566 UUID regionUuid;
542 }
543 567
544 GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); 568 if (!UUID.TryParse(rawRegionUuid, out regionUuid))
569 {
570 MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid);
571 return;
572 }
545 573
546 if (region == null) 574 GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid);
547 {
548 MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
549 return;
550 }
551 575
552 if (DeregisterRegion(regionUuid)) 576 if (region == null)
553 { 577 {
554 MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); 578 MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
555 } 579 return;
556 else 580 }
557 {
558 // I don't think this can ever occur if we know that the region exists.
559 MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid);
560 }
561 581
562 return; 582 if (DeregisterRegion(regionUuid))
583 {
584 MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid);
585 }
586 else
587 {
588 // I don't think this can ever occur if we know that the region exists.
589 MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid);
590 }
591 }
563 } 592 }
564 593
565 private void HandleShowRegions(string module, string[] cmd) 594 private void HandleShowRegions(string module, string[] cmd)
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