From e950829c944887c9cbf9177ea9c49403eaf4ebf3 Mon Sep 17 00:00:00 2001 From: lickx <11088547+lickx@users.noreply.github.com> Date: Thu, 15 Jan 2026 06:23:01 +0100 Subject: [PATCH] Now does allow GridService from other instance --- .../Server/Handlers/Grid/GridInfoHandlers.cs | 52 ++++++++++++------- bin/Robust.HG.ini.example | 2 + bin/Robust.ini.example | 2 + 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index 6c311bca83..fdbcaa937f 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs @@ -36,12 +36,16 @@ using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Services.Interfaces; using OpenSim.Services.Base; +using OpenSim.Server.Base; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Data; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; + namespace OpenSim.Server.Handlers.Grid { public class GridInfoHandlers @@ -55,7 +59,7 @@ namespace OpenSim.Server.Handlers.Grid private byte[] cachedStatAnswer = null; private bool stats_available = false; private int _lastrun; - protected IRegionData m_Database_regions = null; + protected IGridService m_GridService = null; protected IGridUserData m_Database_griduser = null; /// @@ -85,30 +89,35 @@ namespace OpenSim.Server.Handlers.Grid if (stats_available) { stats_available = false; - IConfig dbConfig = configSource.Configs["DatabaseService"]; - if (dbConfig is not null) + string gridService = gridCfg.GetString("GridService", string.Empty); + if (!string.IsNullOrWhiteSpace(gridService)) { - ServiceBase serviceBase = new(configSource); - string dllName = dbConfig.GetString("StorageProvider", String.Empty); - string connString = dbConfig.GetString("ConnectionString", String.Empty); - - if (dllName.Length != 0 && connString.Length != 0) + object[] args = new object[] { configSource }; + m_GridService = ServerUtils.LoadPlugin(gridService, args); + if (m_GridService != null) { - m_Database_regions = serviceBase.LoadPlugin(dllName, [connString, "regions"]); - if(m_Database_regions != null) + IConfig dbConfig = configSource.Configs["DatabaseService"]; + if (dbConfig is not null) { - m_Database_griduser = serviceBase.LoadPlugin(dllName, [connString, "GridUser"]); - if (m_Database_griduser != null) + ServiceBase serviceBase = new(configSource); + string dllName = dbConfig.GetString("StorageProvider", String.Empty); + string connString = dbConfig.GetString("ConnectionString", String.Empty); + + if (dllName.Length != 0 && connString.Length != 0) { - stats_available = true; - _log.Debug("[GRID INFO SERVICE]: Grid Stats enabled"); + m_Database_griduser = serviceBase.LoadPlugin(dllName, [connString, "GridUser"]); + if (m_Database_griduser != null) + { + stats_available = true; + _log.Debug("[GRID INFO SERVICE]: Grid Stats enabled"); + } } } } } if (!stats_available) { - _log.Warn("[GRID INFO SERVICE]: Could not find or initialize Database Service config. Grid stats will be unavailable!"); + _log.Warn("[GRID INFO SERVICE]: Could not initialize. Grid stats will be unavailable!"); } } @@ -274,13 +283,16 @@ namespace OpenSim.Server.Handlers.Grid try { // Fetch region data - List regions = m_Database_regions.GetOnlineRegions(UUID.Zero); - foreach (RegionData region in regions) + if (m_GridService is not null) { - // Count individual region equivalent - region_count += (region.sizeX * region.sizeY) >> 16; + List regions = m_GridService.GetOnlineRegions(UUID.Zero, 0, 0, int.MaxValue); + foreach (GridRegion region in regions) + { + // Count individual region equivalent + region_count += (region.RegionSizeX * region.RegionSizeY) >> 16; + } + regions = null; } - regions = null; // Fetch all grid users, can't do a simple query unfortunately GridUserData[] gridusers = m_Database_griduser.GetAll(string.Empty); diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index b3c513c9f4..95816c7ce3 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -640,6 +640,8 @@ [GridInfoService] + GridService = "OpenSim.Services.GridService.dll:GridService" + ; These settings are used to return information on a get_grid_info call. ; Client launcher scripts and third-party clients make use of this to ; autoconfigure the client and to provide a nice user experience. If you diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 1dfaa5265d..660a016e23 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -561,6 +561,8 @@ [GridInfoService] + GridService = "OpenSim.Services.GridService.dll:GridService" + ; These settings are used to return information on a get_grid_info call. ; Client launcher scripts and third-party clients make use of this to ; autoconfigure the client and to provide a nice user experience. If you