From b16abc8166c29585cb76cc55c3bdd76e5833cb4f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Jan 2017 19:07:37 +0000 Subject: Massive tab and trailing space cleanup --- .../Grid/LocalGridServiceConnector.cs | 14 ++--- .../ServiceConnectorsOut/Grid/RegionInfoCache.cs | 66 +++++++++++----------- .../Grid/RemoteGridServiceConnector.cs | 22 ++++---- .../Grid/Tests/GridConnectorsTests.cs | 2 +- 4 files changed, 52 insertions(+), 52 deletions(-) (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 70733fc..d220568 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public LocalGridServicesConnector(IConfigSource source) { m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly.", LogHeader); - InitialiseService(source, null); + InitialiseService(source, null); } public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache) @@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region ISharedRegionModule - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { string name = moduleConfig.GetString("GridServices", ""); if (name == Name) - { + { if(InitialiseService(source, null)) m_log.Info("[LOCAL GRID SERVICE CONNECTOR]: Local grid connector enabled"); } @@ -190,8 +190,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid // This shouldn't happen if (region == null) return; - - m_RegionInfoCache.CacheNearNeighbour(region.ScopeID, region); + + m_RegionInfoCache.CacheNearNeighbour(region.ScopeID, region); } public string RegisterRegion(UUID scopeID, GridRegion regionInfo) @@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public List GetNeighbours(UUID scopeID, UUID regionID) { - return m_GridService.GetNeighbours(scopeID, regionID); + return m_GridService.GetNeighbours(scopeID, regionID); } public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) @@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { return m_GridService.GetHyperlinks(scopeID); } - + public int GetRegionFlags(UUID scopeID, UUID regionID) { return m_GridService.GetRegionFlags(scopeID, regionID); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs index 5eb525b..84e52f7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid // private static readonly ILog m_log = // LogManager.GetLogger( // MethodBase.GetCurrentMethod().DeclaringType); - + private static RegionsExpiringCache m_Cache; private int numberInstances; @@ -60,12 +60,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (rinfo != null) this.Cache(rinfo.ScopeID, rinfo); } - + public void Cache(UUID scopeID, GridRegion rinfo) { if (rinfo == null) return; - + m_Cache.AddOrUpdate(scopeID, rinfo, CACHE_EXPIRATION_SECONDS); } @@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if (rinfo == null) return; - + m_Cache.AddOrUpdate(rinfo.ScopeID, rinfo, 1e7f); } @@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if (rinfo == null) return; - + m_Cache.AddOrUpdate(scopeID, rinfo, CACHE_EXPIRATION_SECONDS); } @@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if (rinfo == null) return; - + m_Cache.AddOrUpdate(scopeID, rinfo, expireSeconds); } @@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid inCache = true; return rinfo; } - + return null; } @@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid inCache = true; return rinfo; } - + return null; } } @@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private Dictionary byname; private Dictionary byuuid; // includes handles to the inside of large regions - private Dictionary innerHandles = new Dictionary(); + private Dictionary innerHandles = new Dictionary(); public RegionInfoForScope() { @@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid byuuid = new Dictionary(); storage[handle] = region; - expires[handle] = expire; + expires[handle] = expire; byname[region.RegionName] = handle; byuuid[region.RegionID] = handle; @@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid storage[handle] = region; byname[region.RegionName] = handle; byuuid[region.RegionID] = handle; - + } public void Remove(GridRegion region) @@ -483,7 +483,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if(!innerHandles.ContainsKey(handle)) return null; - + ulong rhandle = innerHandles[handle]; if(storage.ContainsKey(rhandle)) return storage[rhandle]; @@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if(byname == null || !byname.ContainsKey(name)) return null; - + ulong handle = byname[name]; if(storage.ContainsKey(handle)) return storage[handle]; @@ -528,7 +528,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if(!innerHandles.ContainsKey(handle)) return null; - + ulong rhandle = innerHandles[handle]; if(!storage.ContainsKey(rhandle)) return null; @@ -536,7 +536,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid GridRegion r = storage[rhandle]; if(r == null) return null; - + // extra check, possible redundant int test = r.RegionLocX; @@ -552,7 +552,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (y < test) return r; -/* +/* // next do the harder work foreach(KeyValuePair kvp in storage) { @@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if(kvp.Value < now) toexpire.Add(kvp.Key); } - + if(toexpire.Count == 0) return expires.Count; @@ -597,7 +597,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid Clear(); return 0; } - + foreach(ulong h in toexpire) { if(storage != null) @@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid innerHandles[fh.toHandle()] = handle; fh.y += 256; } - + fh.y = startY; fh.x += 256; } @@ -684,18 +684,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid innerHandles.Remove(fh.toHandle()); fh.y += 256; } - + fh.y = startY; fh.x += 256; } } } - + public class RegionsExpiringCache { const double CACHE_PURGE_HZ = 60; // seconds const int MAX_LOCK_WAIT = 10000; // milliseconds - + /// For thread safety object syncRoot = new object(); /// For thread safety @@ -728,7 +728,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid ris = new RegionInfoForScope(region, expire); InfobyScope[scope] = ris; } - else + else ris.AddUpdate(region, expire); return true; @@ -748,7 +748,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid } finally { Monitor.Exit(syncRoot); } } - + public bool Contains(UUID scope, GridRegion region) { if(region == null) @@ -758,11 +758,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); try - { + { RegionInfoForScope ris = null; if(!InfobyScope.TryGetValue(scope, out ris) || ris == null) return false; - + return ris.Contains(region); } finally { Monitor.Exit(syncRoot); } @@ -774,11 +774,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); try - { + { RegionInfoForScope ris = null; if(!InfobyScope.TryGetValue(scope, out ris) || ris == null) return false; - + return ris.Contains(handle); } finally { Monitor.Exit(syncRoot); } @@ -790,7 +790,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); try - { + { int count = 0; foreach(RegionInfoForScope ris in InfobyScope.Values) count += ris.Count(); @@ -804,7 +804,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); try - { + { RegionInfoForScope ris = null; if(!InfobyScope.TryGetValue(scope, out ris) || ris == null) return false; @@ -825,7 +825,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); try - { + { RegionInfoForScope ris = null; if(!InfobyScope.TryGetValue(scope, out ris) || ris == null) return false; @@ -940,7 +940,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private void PurgeCache(object sender, System.Timers.ElapsedEventArgs e) { // Only let one thread purge at once - a buildup could cause a crash - // This could cause the purge to be delayed while there are lots of read/write ops + // This could cause the purge to be delayed while there are lots of read/write ops // happening on the cache if (!Monitor.TryEnter(isPurging)) return; @@ -961,7 +961,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (kvp.Value.expire(now) == 0) expiredscopes.Add(kvp.Key); } - + if (expiredscopes.Count > 0) { foreach (UUID sid in expiredscopes) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 50e4c8a..ee17093 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid private IGridService m_RemoteGridService; private RegionInfoCache m_RegionInfoCache; - + public RemoteGridServicesConnector() { } @@ -70,7 +70,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region ISharedRegionmodule - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return false; } - Object[] args = new Object[] { source }; + Object[] args = new Object[] { source }; m_RemoteGridService = ServerUtils.LoadPlugin(networkConnector, args); m_LocalGridService = new LocalGridServicesConnector(source, m_RegionInfoCache); @@ -130,11 +130,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); // Legacy. Remove soon! m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); - - Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper); + + Util.checkServiceURI(m_ThisGatekeeper, out m_ThisGatekeeper); return true; - } + } public void PostInitialise() { @@ -249,14 +249,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) return rinfo; // no HG - + string regionURI = ""; if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) - return rinfo; // invalid + return rinfo; // invalid if(m_ThisGatekeeper != regionURI) return rinfo; // not local grid } - + rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); m_RegionInfoCache.Cache(scopeID, rinfo); return rinfo; @@ -275,10 +275,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if(string.IsNullOrWhiteSpace(m_ThisGatekeeper)) return rinfo; // no HG - + string regionURI = ""; if(!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) - return rinfo; // invalid + return rinfo; // invalid if(m_ThisGatekeeper != regionURI) return rinfo; // not local grid } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 044e0e5..1378368 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests Scene s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r1.RegionID; m_LocalConnector.AddRegion(s); - + GridRegion r2 = new GridRegion(); r2.RegionName = "Test Region 2"; r2.RegionID = new UUID(2); -- cgit v1.1