diff options
Diffstat (limited to '')
7 files changed, 128 insertions, 4 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index f982cc1..af91cdb 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -525,6 +525,57 @@ namespace OpenSim.Services.Connectors | |||
525 | return rinfos; | 525 | return rinfos; |
526 | } | 526 | } |
527 | 527 | ||
528 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
529 | { | ||
530 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
531 | |||
532 | sendData["SCOPEID"] = scopeID.ToString(); | ||
533 | |||
534 | sendData["METHOD"] = "get_default_hypergrid_regions"; | ||
535 | |||
536 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
537 | string reply = string.Empty; | ||
538 | string uri = m_ServerURI + "/grid"; | ||
539 | try | ||
540 | { | ||
541 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
542 | uri, | ||
543 | ServerUtils.BuildQueryString(sendData)); | ||
544 | |||
545 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
546 | } | ||
547 | catch (Exception e) | ||
548 | { | ||
549 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
550 | return rinfos; | ||
551 | } | ||
552 | |||
553 | if (reply != string.Empty) | ||
554 | { | ||
555 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
556 | |||
557 | if (replyData != null) | ||
558 | { | ||
559 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
560 | foreach (object r in rinfosList) | ||
561 | { | ||
562 | if (r is Dictionary<string, object>) | ||
563 | { | ||
564 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
565 | rinfos.Add(rinfo); | ||
566 | } | ||
567 | } | ||
568 | } | ||
569 | else | ||
570 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions {0} received null response", | ||
571 | scopeID); | ||
572 | } | ||
573 | else | ||
574 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions received null reply"); | ||
575 | |||
576 | return rinfos; | ||
577 | } | ||
578 | |||
528 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 579 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
529 | { | 580 | { |
530 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 581 | 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 043d131..36a5182 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -341,6 +341,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
341 | return new List<GridRegion>(0); | 341 | return new List<GridRegion>(0); |
342 | } | 342 | } |
343 | 343 | ||
344 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
345 | { | ||
346 | // TODO: Allow specifying the default grid location | ||
347 | return GetDefaultRegions(scopeID); | ||
348 | } | ||
349 | |||
344 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 350 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
345 | { | 351 | { |
346 | GridRegion defRegion = GetNearestRegion(new Vector3d(x, y, 0.0), true); | 352 | 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 cecbe9e..e3c70d3 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 | ||
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index b1cdd45..944411f 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -47,6 +47,44 @@ namespace OpenSim.Services.UserAccountService | |||
47 | public GridUserService(IConfigSource config) : base(config) | 47 | public GridUserService(IConfigSource config) : base(config) |
48 | { | 48 | { |
49 | m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); | 49 | m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); |
50 | |||
51 | MainConsole.Instance.Commands.AddCommand( | ||
52 | "Users", false, | ||
53 | "show grid users online", | ||
54 | "show grid users online", | ||
55 | "Show number of grid users registered as online.", | ||
56 | "This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." | ||
57 | + "For this reason, users online for more than 5 days are not currently counted", | ||
58 | HandleShowGridUsersOnline); | ||
59 | } | ||
60 | |||
61 | protected void HandleShowGridUsersOnline(string module, string[] cmdparams) | ||
62 | { | ||
63 | // if (cmdparams.Length != 4) | ||
64 | // { | ||
65 | // MainConsole.Instance.Output("Usage: show grid users online"); | ||
66 | // return; | ||
67 | // } | ||
68 | |||
69 | // int onlineCount; | ||
70 | int onlineRecentlyCount = 0; | ||
71 | |||
72 | DateTime now = DateTime.UtcNow; | ||
73 | |||
74 | foreach (GridUserData gu in m_Database.GetAll("")) | ||
75 | { | ||
76 | if (bool.Parse(gu.Data["Online"])) | ||
77 | { | ||
78 | // onlineCount++; | ||
79 | |||
80 | int unixLoginTime = int.Parse(gu.Data["Login"]); | ||
81 | |||
82 | if ((now - Util.ToDateTime(unixLoginTime)).Days < 5) | ||
83 | onlineRecentlyCount++; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | MainConsole.Instance.OutputFormat("Users online: {0}", onlineRecentlyCount); | ||
50 | } | 88 | } |
51 | 89 | ||
52 | public virtual GridUserInfo GetGridUserInfo(string userID) | 90 | public virtual GridUserInfo GetGridUserInfo(string userID) |