From a932f24ba4583f5a0b7a149ffc39ac4814df3c31 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 03:53:18 +0100 Subject: minor fix on sensorrepeat --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1808c34..cc98bbb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins ts.arc = arc; ts.host = host; - ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); + ts.next = DateTime.UtcNow.AddSeconds(ts.interval); AddSenseRepeater(ts); } @@ -196,14 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public void CheckSenseRepeaterEvents() { // Go through all timers - foreach (SensorInfo ts in SenseRepeaters) + + List curSensors; + lock(SenseRepeatListLock) + curSensors = SenseRepeaters; + + DateTime now = DateTime.UtcNow; + foreach (SensorInfo ts in curSensors) { // Time has passed? - if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) + if (ts.next < now) { SensorSweep(ts); // set next interval - ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); + ts.next = now.AddSeconds(ts.interval); } } } -- cgit v1.1 From 8bdd4c3ed9cef20bcee931b287c9c4124b409186 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 12:30:59 +0100 Subject: yes it is not destiny grid but destination.. thx u know who :) --- OpenSim/Services/HypergridService/GatekeeperService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 9bf3cf8..c74b514 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -397,9 +397,9 @@ namespace OpenSim.Services.HypergridService m_log.InfoFormat( "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", account.FirstName, account.LastName); - reason = "You appear to be already logged in on destiny grid " + + reason = "You appear to be already logged in on the destination grid " + "Please wait a a minute or two and retry. " + - "If this takes longer than a few minutes please contact the grid owner. "; + "If this takes longer than a few minutes please contact the grid owner."; return false; } } -- cgit v1.1 From 0f2ab6bddd3faed35f6845e09461f818c74fa0eb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 14:20:06 +0100 Subject: soem changes on connections limits --- OpenSim/Region/Application/Application.cs | 2 +- OpenSim/Server/ServerMain.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 5cb6a88..7b9d35d 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -74,7 +74,7 @@ namespace OpenSim AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - ServicePointManager.DefaultConnectionLimit = 12; + ServicePointManager.DefaultConnectionLimit = 128; ServicePointManager.UseNagleAlgorithm = false; // Add the arguments supplied when running the application to the configuration diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index c343044..74bb163 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -54,8 +54,7 @@ namespace OpenSim.Server public static int Main(string[] args) { - // Make sure we don't get outbound connections queueing - ServicePointManager.DefaultConnectionLimit = 50; + ServicePointManager.DefaultConnectionLimit = 4096; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 5e577baa103e371eb3c8a6d5244386807f6067ea Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 14:42:21 +0100 Subject: fix a null ref on hg gatekeeper --- OpenSim/Services/HypergridService/GatekeeperService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index c74b514..3e6b43a 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -376,7 +376,7 @@ namespace OpenSim.Services.HypergridService return false; } - if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e")) + if(aCircuit.AgentID == new UUID("6571e388-6218-4574-87db-f9379718315e")) { // really? reason = "Invalid account ID"; -- cgit v1.1 From d08df7bda71e1ad0b3001ac160ea5553fe7d7ad5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 15:22:16 +0100 Subject: mantis 8165: fix a null ref on hg gatekeeper on another place --- OpenSim/Services/HypergridService/GatekeeperService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 3e6b43a..8e3cf0e 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -376,7 +376,8 @@ namespace OpenSim.Services.HypergridService return false; } - if(aCircuit.AgentID == new UUID("6571e388-6218-4574-87db-f9379718315e")) + UUID agentID = aCircuit.AgentID; + if(agentID == new UUID("6571e388-6218-4574-87db-f9379718315e")) { // really? reason = "Invalid account ID"; @@ -385,14 +386,14 @@ namespace OpenSim.Services.HypergridService if(m_GridUserService != null) { - string PrincipalIDstr = account.PrincipalID.ToString(); + string PrincipalIDstr = agentID.ToString(); GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr); if(!m_allowDuplicatePresences) { if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) { - if(SendAgentGodKillToRegion(UUID.Zero, account.PrincipalID, guinfo)) + if(SendAgentGodKillToRegion(UUID.Zero, agentID, guinfo)) { m_log.InfoFormat( "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", -- cgit v1.1 From 948138a3a4ed08b96b12a31049e658c570345a10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 16:45:58 +0100 Subject: lower connection limits again --- OpenSim/Region/Application/Application.cs | 6 +++++- OpenSim/Server/ServerMain.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 7b9d35d..bd2445c 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -74,7 +74,11 @@ namespace OpenSim AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - ServicePointManager.DefaultConnectionLimit = 128; + if(!Util.IsWindows()) + ServicePointManager.DefaultConnectionLimit = 12; + else + ServicePointManager.DefaultConnectionLimit = 32; + ServicePointManager.UseNagleAlgorithm = false; // Add the arguments supplied when running the application to the configuration diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 74bb163..6938db7 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server public static int Main(string[] args) { - ServicePointManager.DefaultConnectionLimit = 4096; + ServicePointManager.DefaultConnectionLimit = 64; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 086eb28a9183cd0896fefc51d1a689162bd96299 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 May 2017 22:03:53 +0100 Subject: a bit more on ServicePointManager --- OpenSim/Region/Application/Application.cs | 7 ++++--- OpenSim/Server/ServerMain.cs | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index bd2445c..bc6d7b3 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -74,11 +74,12 @@ namespace OpenSim AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); - if(!Util.IsWindows()) - ServicePointManager.DefaultConnectionLimit = 12; - else + if(Util.IsWindows()) ServicePointManager.DefaultConnectionLimit = 32; + else + ServicePointManager.DefaultConnectionLimit = 12; + ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; // Add the arguments supplied when running the application to the configuration diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 6938db7..96b0a82 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,6 +55,7 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; + ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; m_Server = new HttpServerBase("R.O.B.U.S.T.", args); -- cgit v1.1 From 9ea49d107d2df96de7c56e561ebd46b0f804bfa3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 15:58:35 +0100 Subject: fix wrong locking on unused path it case it does get uses. Thanks LaNani Sundara --- OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index 55ec13e..fe20767 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs @@ -485,7 +485,7 @@ namespace OpenSim.Framework try {} finally { - rwLock.EnterUpgradeableReadLock(); + rwLock.EnterWriteLock(); gotWriteLock = true; } -- cgit v1.1 From 16f02cb6fd57c5ad015b1c9e5edd17a4dbed37ef Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 16:34:29 +0100 Subject: we can't allow abort to change only one dic --- .../Framework/DoubleDictionaryThreadAbortSafe.cs | 62 ++++++++++++---------- 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs index fe20767..816523b 100644 --- a/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs +++ b/OpenSim/Framework/DoubleDictionaryThreadAbortSafe.cs @@ -74,21 +74,19 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + if (Dictionary1.ContainsKey(key1)) + { + if (!Dictionary2.ContainsKey(key2)) + throw new ArgumentException("key1 exists in the dictionary but not key2"); + } + else if (Dictionary2.ContainsKey(key2)) + { + if (!Dictionary1.ContainsKey(key1)) + throw new ArgumentException("key2 exists in the dictionary but not key1"); + } + Dictionary1[key1] = value; + Dictionary2[key2] = value; } - - if (Dictionary1.ContainsKey(key1)) - { - if (!Dictionary2.ContainsKey(key2)) - throw new ArgumentException("key1 exists in the dictionary but not key2"); - } - else if (Dictionary2.ContainsKey(key2)) - { - if (!Dictionary1.ContainsKey(key1)) - throw new ArgumentException("key2 exists in the dictionary but not key1"); - } - - Dictionary1[key1] = value; - Dictionary2[key2] = value; } finally { @@ -112,10 +110,9 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + Dictionary1.Remove(key1); + success = Dictionary2.Remove(key2); } - - Dictionary1.Remove(key1); - success = Dictionary2.Remove(key2); } finally { @@ -151,8 +148,12 @@ namespace OpenSim.Framework { if (kvp.Value.Equals(value)) { - Dictionary1.Remove(key1); - Dictionary2.Remove(kvp.Key); + try { } + finally + { + Dictionary1.Remove(key1); + Dictionary2.Remove(kvp.Key); + } found = true; break; } @@ -193,8 +194,12 @@ namespace OpenSim.Framework { if (kvp.Value.Equals(value)) { - Dictionary2.Remove(key2); - Dictionary1.Remove(kvp.Key); + try { } + finally + { + Dictionary2.Remove(key2); + Dictionary1.Remove(kvp.Key); + } found = true; break; } @@ -224,10 +229,9 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotLock = true; + Dictionary1.Clear(); + Dictionary2.Clear(); } - - Dictionary1.Clear(); - Dictionary2.Clear(); } finally { @@ -487,13 +491,13 @@ namespace OpenSim.Framework { rwLock.EnterWriteLock(); gotWriteLock = true; - } - for (int i = 0; i < list.Count; i++) - Dictionary1.Remove(list[i]); + for (int i = 0; i < list.Count; i++) + Dictionary1.Remove(list[i]); - for (int i = 0; i < list2.Count; i++) - Dictionary2.Remove(list2[i]); + for (int i = 0; i < list2.Count; i++) + Dictionary2.Remove(list2[i]); + } } finally { -- cgit v1.1 From 7cf82a71d6db53fd3705ae65b4bc45d8f8488ada Mon Sep 17 00:00:00 2001 From: Geir Nøklebye Date: Sat, 13 May 2017 17:43:59 +0100 Subject: PGSQL: Convert PassCollision in table prims to bool to avoid a hopeless cast that fails with newer versions of NPGSQL. Signed-off-by: UbitUmarov --- OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 7 ++++--- OpenSim/Data/PGSQL/Resources/RegionStore.migrations | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 625120b..4d3ea96 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -1789,6 +1789,7 @@ namespace OpenSim.Data.PGSQL prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); prim.PassTouches = (bool)primRow["PassTouches"]; + prim.PassCollisions = (bool)primRow["PassCollisions"]; if (!(primRow["MediaURL"] is System.DBNull)) prim.MediaUrl = (string)primRow["MediaURL"]; @@ -2212,7 +2213,7 @@ namespace OpenSim.Data.PGSQL parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches)); - parameters.Add(_Database.CreateParameter("PassCollisions", prim.PassCollisions)); + parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions)); if (prim.PassTouches) @@ -2221,9 +2222,9 @@ namespace OpenSim.Data.PGSQL parameters.Add(_Database.CreateParameter("PassTouches", false)); if (prim.PassCollisions) - parameters.Add(_Database.CreateParameter("PassCollisions", 1)); + parameters.Add(_Database.CreateParameter("PassCollisions", false)); else - parameters.Add(_Database.CreateParameter("PassCollisions", 0)); + parameters.Add(_Database.CreateParameter("PassCollisions", true)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations index 948d177..fcefb6b 100644 --- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations @@ -1211,3 +1211,17 @@ BEGIN TRANSACTION; ALTER TABLE prims ADD "PhysInertia" TEXT; COMMIT; + + +:VERSION 47 #---- Convert field PassCollisions in table prims to BOOLEAN + +BEGIN TRANSACTION; + +ALTER TABLE "public"."prims" ALTER COLUMN "PassCollisions" DROP DEFAULT; +ALTER TABLE "public"."prims" + ALTER COLUMN "PassCollisions" TYPE BOOLEAN + USING CASE WHEN "PassCollisions" = 0 THEN FALSE + WHEN "PassCollisions" = 1 THEN TRUE + ELSE NULL + END; +COMMIT; -- cgit v1.1 From dd0269df4859197ed3071db345b65eaca8a3897e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 17:22:56 +0100 Subject: fix passcollisions bool value on store --- OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 4d3ea96..f4af40b 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -2222,9 +2222,9 @@ namespace OpenSim.Data.PGSQL parameters.Add(_Database.CreateParameter("PassTouches", false)); if (prim.PassCollisions) - parameters.Add(_Database.CreateParameter("PassCollisions", false)); - else parameters.Add(_Database.CreateParameter("PassCollisions", true)); + else + parameters.Add(_Database.CreateParameter("PassCollisions", false)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); -- cgit v1.1 From 25ca8695f3746b000fee42a0d73b91dfa6a1c9c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 May 2017 20:21:56 +0100 Subject: find parcels by GlobalID.. well most time --- OpenSim/Framework/ILandChannel.cs | 2 + .../Region/CoreModules/World/Land/DwellModule.cs | 3 ++ .../Region/CoreModules/World/Land/LandChannel.cs | 9 ++++ .../CoreModules/World/Land/LandManagementModule.cs | 58 +++++++++++++++++----- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 5 ++ 5 files changed, 65 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 44a24b9..12a8228 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs @@ -76,6 +76,8 @@ namespace OpenSim.Region.Framework.Interfaces /// ILandObject GetLandObject(int localID); + ILandObject GetLandObject(UUID GlobalID); + /// /// Clear the land channel of all parcels. /// diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index 70c6028..5f1eab2 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -120,6 +120,9 @@ namespace OpenSim.Region.CoreModules.World.Land public int GetDwell(UUID parcelID) { + ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); + if (parcel != null && parcel.LandData != null) + return (int)parcel.LandData.Dwell; return 0; } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index e4c0373..b59e2af 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -106,6 +106,15 @@ namespace OpenSim.Region.CoreModules.World.Land return null; } + public ILandObject GetLandObject(UUID GlobalID) + { + if (m_landManagementModule != null) + { + return m_landManagementModule.GetLandObject(GlobalID); + } + return null; + } + public ILandObject GetLandObject(Vector3 position) { return GetLandObject(position.X, position.Y); diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 53b9796..e1f2975 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -92,6 +92,7 @@ namespace OpenSim.Region.CoreModules.World.Land //ubit: removed the readonly so i can move it around private Dictionary m_landList = new Dictionary(); + private Dictionary m_landUUIDList = new Dictionary(); private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; @@ -249,7 +250,10 @@ namespace OpenSim.Region.CoreModules.World.Land lock (m_landList) { if (m_landList.TryGetValue(local_id, out land)) + { land.LandData = newData; + m_landUUIDList[newData.GlobalID] = local_id; + } } if (land != null) @@ -271,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Land lock (m_landList) { m_landList.Clear(); + m_landUUIDList.Clear(); m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; @@ -434,6 +439,15 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelAvatarIsEntering != null && avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) { + if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero) + { + ILandObject last = GetLandObject(avatar.currentParcelUUID); + if(last != null) + { + + } + } + SendLandUpdate(avatar, parcelAvatarIsEntering); avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; EnforceBans(parcelAvatarIsEntering, avatar); @@ -656,6 +670,7 @@ namespace OpenSim.Region.CoreModules.World.Land } m_landList.Add(newLandLocalID, new_land); + m_landUUIDList[new_land.LandData.GlobalID] = newLandLocalID; m_lastLandLocalID++; } @@ -690,6 +705,8 @@ namespace OpenSim.Region.CoreModules.World.Land land = m_landList[local_id]; m_landList.Remove(local_id); + if(land.LandData != null) + m_landUUIDList.Remove(land.LandData.GlobalID); } m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); @@ -745,6 +762,24 @@ namespace OpenSim.Region.CoreModules.World.Land UpdateLandObject(master.LandData.LocalID, master.LandData); } + public ILandObject GetLandObject(UUID globalID) + { + lock (m_landList) + { + int lid = -1; + if(m_landUUIDList.TryGetValue(globalID, out lid) && lid >= 0) + { + if (m_landList.ContainsKey(lid)) + { + return m_landList[lid]; + } + else + m_landUUIDList.Remove(globalID); // auto heal + } + } + return null; + } + public ILandObject GetLandObject(int parcelLocalID) { lock (m_landList) @@ -1351,7 +1386,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(local_id, out land); @@ -1360,7 +1395,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { m_scene.EventManager.TriggerParcelPrimCountUpdate(); - m_landList[local_id].SendLandObjectOwners(remote_client); + land.SendLandObjectOwners(remote_client); } else { @@ -1370,7 +1405,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(local_id, out land); @@ -1393,7 +1428,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(local_id, out land); @@ -1417,7 +1452,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void ClientOnParcelReclaim(int local_id, IClientAPI remote_client) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(local_id, out land); @@ -1503,17 +1538,16 @@ namespace OpenSim.Region.CoreModules.World.Land void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(parcelLocalID, out land); } - if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) - return; - if (land != null) { + if (!m_scene.Permissions.CanDeedParcel(remote_client.AgentId, land)) + return; land.DeedToGroup(groupID); } } @@ -1763,7 +1797,7 @@ namespace OpenSim.Region.CoreModules.World.Land land_update.GroupAVSounds = true; } - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(parcelID, out land); @@ -1951,7 +1985,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) { - ILandObject land; + ILandObject land = null; lock (m_landList) { m_landList.TryGetValue(localID, out land); @@ -2248,7 +2282,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[2], out landLocalId)) return; - ILandObject lo; + ILandObject lo = null; lock (m_landList) { diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 3d44a33..48dc840 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -96,6 +96,11 @@ namespace OpenSim.Tests.Common return GetNoLand(); } + public ILandObject GetLandObject(UUID ID) + { + return GetNoLand(); + } + public ILandObject GetLandObject(float x, float y) { return GetNoLand(); -- cgit v1.1 From cb21caae777341b7b4af724e86b9a82b9b827c43 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 01:44:04 +0100 Subject: fix some issue on parcels loading and make parcels dwell show something. Resolution is 2.5min aprox. --- OpenSim/Framework/LandData.cs | 12 ++++--- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Region/CoreModules/World/Land/DwellModule.cs | 26 +++++++++++--- .../CoreModules/World/Land/LandManagementModule.cs | 16 ++------- .../Region/CoreModules/World/Land/LandObject.cs | 40 ++++++++++++++++++++-- .../Region/Framework/Interfaces/IDwellModule.cs | 1 + OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++ 7 files changed, 74 insertions(+), 26 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 13d2977..13b58be 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -97,7 +97,9 @@ namespace OpenSim.Framework private bool _mediaLoop = false; private bool _obscureMusic = false; private bool _obscureMedia = false; - private float _dwell = 0; + + private float m_dwell = 0; + public double LastDwellTimeMS; public bool SeeAVs { get; set; } public bool AnyAVSounds { get; set; } @@ -111,11 +113,12 @@ namespace OpenSim.Framework { get { - return _dwell; + return m_dwell; } set { - _dwell = value; + m_dwell = value; + LastDwellTimeMS = Util.GetTimeStampMS(); } } @@ -735,6 +738,7 @@ namespace OpenSim.Framework SeeAVs = true; AnyAVSounds = true; GroupAVSounds = true; + LastDwellTimeMS = Util.GetTimeStampMS(); } /// @@ -784,7 +788,7 @@ namespace OpenSim.Framework landData._obscureMedia = _obscureMedia; landData._simwideArea = _simwideArea; landData._simwidePrims = _simwidePrims; - landData._dwell = _dwell; + landData.m_dwell = m_dwell; landData.SeeAVs = SeeAVs; landData.AnyAVSounds = AnyAVSounds; landData.GroupAVSounds = GroupAVSounds; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5b3c3e6..6a3960d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3114,7 +3114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float dwell = 0.0f; IDwellModule dwellModule = m_scene.RequestModuleInterface(); if (dwellModule != null) - dwell = dwellModule.GetDwell(land.GlobalID); + dwell = dwellModule.GetDwell(land); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index 5f1eab2..55a341e 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -53,7 +53,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.Land { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")] - public class DefaultDwellModule : IDwellModule, INonSharedRegionModule + public class DefaultDwellModule : INonSharedRegionModule, IDwellModule { private Scene m_scene; private IConfigSource m_Config; @@ -88,16 +88,21 @@ namespace OpenSim.Region.CoreModules.World.Land return; m_scene = scene; - - m_scene.EventManager.OnNewClient += OnNewClient; + m_scene.RegisterModuleInterface(this); } public void RegionLoaded(Scene scene) { + if (!m_Enabled) + return; + m_scene.EventManager.OnNewClient += OnNewClient; } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + m_scene.EventManager.OnNewClient -= OnNewClient; } public void Close() @@ -115,15 +120,26 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcel == null) return; - client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell); + LandData land = parcel.LandData; + if(land!= null) + client.SendParcelDwellReply(localID, land.GlobalID, land.Dwell); } + public int GetDwell(UUID parcelID) { ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); if (parcel != null && parcel.LandData != null) - return (int)parcel.LandData.Dwell; + return (int)(parcel.LandData.Dwell + 0.5f); + return 0; + } + + public int GetDwell(LandData land) + { + if (land != null) + return (int)(land.Dwell + 0.5f); return 0; } + } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index e1f2975..ce982a2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -439,15 +439,6 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelAvatarIsEntering != null && avatar.currentParcelUUID != parcelAvatarIsEntering.LandData.GlobalID) { - if(!avatar.IsNPC && avatar.currentParcelUUID != UUID.Zero) - { - ILandObject last = GetLandObject(avatar.currentParcelUUID); - if(last != null) - { - - } - } - SendLandUpdate(avatar, parcelAvatarIsEntering); avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID; EnforceBans(parcelAvatarIsEntering, avatar); @@ -602,10 +593,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// The land object being added. /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. /// - public ILandObject AddLandObject(ILandObject land) + public ILandObject AddLandObject(ILandObject new_land) { - ILandObject new_land = land.Copy(); - // Only now can we add the prim counts to the land object - we rely on the global ID which is generated // as a random UUID inside LandData initialization if (m_primCountModule != null) @@ -1621,8 +1610,7 @@ namespace OpenSim.Region.CoreModules.World.Land private void IncomingLandObjectFromStorage(LandData data) { - ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); - new_land.LandData = data.Copy(); + ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene, data); new_land.SetLandBitmapFromByteArray(); AddLandObject(new_land); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 2b5cb31..cb54184 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene = scene; } - public LandObject(UUID owner_id, bool is_group_owned, Scene scene) + public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null) { m_scene = scene; if (m_scene == null) @@ -278,12 +278,17 @@ namespace OpenSim.Region.CoreModules.World.Land else LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; - LandData = new LandData(); + if(data == null) + LandData = new LandData(); + else + LandData = data; + LandData.OwnerID = owner_id; if (is_group_owned) LandData.GroupID = owner_id; else LandData.GroupID = UUID.Zero; + LandData.IsGroupOwned = is_group_owned; m_scene.EventManager.OnFrame += OnFrame; @@ -1812,6 +1817,37 @@ namespace OpenSim.Region.CoreModules.World.Land ExpireAccessList(); m_expiryCounter = 0; } + + // need to update dwell here bc landdata has no parent info + if(LandData != null) + { + double now = Util.GetTimeStampMS(); + double elapsed = now - LandData.LastDwellTimeMS; + if(elapsed > 150000) //2.5 minutes resolution / throttle + { + float dwell = LandData.Dwell; + double cur = dwell * 60000.0; + double decay = 1.5e-8 * cur * elapsed; + cur -= decay; + if(cur < 0) + cur = 0; + + UUID lgid = LandData.GlobalID; + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) + { + if(sp.IsNPC || sp.IsLoggingIn || sp.IsDeleted || sp.currentParcelUUID != lgid) + return; + cur += (now - sp.ParcelDwellTickMS); + sp.ParcelDwellTickMS = now; + }); + + float newdwell = (float)(cur * 1.666666666667e-5); + LandData.Dwell = newdwell; + + if(Math.Abs(newdwell - dwell) > 1.0) + m_scene.EventManager.TriggerLandObjectAdded(this); + } + } } private void ExpireAccessList() diff --git a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs index db50439..ebef5a4 100644 --- a/OpenSim/Region/Framework/Interfaces/IDwellModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IDwellModule.cs @@ -33,5 +33,6 @@ namespace OpenSim.Region.Framework.Interfaces public interface IDwellModule { int GetDwell(UUID parcelID); + int GetDwell(LandData land); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6d4cb52..805c9ad 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -170,6 +170,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_previusParcelHide = false; private bool m_currentParcelHide = false; private object parcelLock = new Object(); + public double ParcelDwellTickMS; public UUID currentParcelUUID { @@ -182,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes bool checksame = true; if (value != m_currentParcelUUID) { + ParcelDwellTickMS = Util.GetTimeStampMS(); m_previusParcelHide = m_currentParcelHide; m_previusParcelUUID = m_currentParcelUUID; checksame = false; @@ -2141,6 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; m_currentParcelUUID = UUID.Zero; + ParcelDwellTickMS = Util.GetTimeStampMS(); if(!IsNPC) { -- cgit v1.1 From 9ab8ce1404259557cb1412af5b3296ced7228d5b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 04:17:48 +0100 Subject: fix remote requests for dwell, so dwell module still called --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +----- .../ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | 6 +++++- .../ServiceConnectorsOut/Land/LocalLandServiceConnector.cs | 4 ++++ OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 3 +++ OpenSim/Server/Handlers/Land/LandHandlers.cs | 1 + OpenSim/Services/Connectors/Land/LandServicesConnector.cs | 2 ++ 6 files changed, 16 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6a3960d..298c933 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3111,10 +3111,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { - float dwell = 0.0f; - IDwellModule dwellModule = m_scene.RequestModuleInterface(); - if (dwellModule != null) - dwell = dwellModule.GetDwell(land); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -3141,7 +3137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = dwell; + reply.Data.Dwell = land.Dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 21483c5..fb8c306 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -151,7 +151,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land x = rx - s.RegionInfo.WorldLocX; y = ry - s.RegionInfo.WorldLocY; regionAccess = s.RegionInfo.AccessLevel; - return s.GetLandData(x, y); + LandData land = s.GetLandData(x, y); + IDwellModule dwellModule = s.RequestModuleInterface(); + if (dwellModule != null) + land.Dwell = dwellModule.GetDwell(land); + return land; } } m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index cad2061..8baf41a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs @@ -143,6 +143,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land { LandData land = s.GetLandData(x, y); regionAccess = s.RegionInfo.AccessLevel; + IDwellModule dwellModule = s.RequestModuleInterface(); + if (dwellModule != null) + land.Dwell = dwellModule.GetDwell(land); + return land; } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ce982a2..6f32a77 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1948,6 +1948,9 @@ namespace OpenSim.Region.CoreModules.World.Land if (data.RegionHandle == m_scene.RegionInfo.RegionHandle) { info = new GridRegion(m_scene.RegionInfo); + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + data.LandData.Dwell = dwellModule.GetDwell(data.LandData); } else { diff --git a/OpenSim/Server/Handlers/Land/LandHandlers.cs b/OpenSim/Server/Handlers/Land/LandHandlers.cs index 150eaae..d74077a 100644 --- a/OpenSim/Server/Handlers/Land/LandHandlers.cs +++ b/OpenSim/Server/Handlers/Land/LandHandlers.cs @@ -85,6 +85,7 @@ namespace OpenSim.Server.Handlers.Land hash["SnapshotID"] = landData.SnapshotID.ToString(); hash["UserLocation"] = landData.UserLocation.ToString(); hash["RegionAccess"] = regionAccess.ToString(); + hash["Dwell"] = landData.Dwell.ToString(); } XmlRpcResponse response = new XmlRpcResponse(); diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 047880a..5492e83 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs @@ -117,6 +117,8 @@ namespace OpenSim.Services.Connectors landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); if (hash["RegionAccess"] != null) regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]); + if(hash["Dwell"] != null) + landData.Dwell = Convert.ToSingle((string)hash["Dwell"]); m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name); } catch (Exception e) -- cgit v1.1 From f968118e23f08a2923f1a190f301d842346951af Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 05:39:22 +0100 Subject: don't do dwell if there is no module active --- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cb54184..9affe7d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected ExpiringCache m_groupMemberCache = new ExpiringCache(); protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds + IDwellModule m_dwellModule; private bool[,] m_landBitmap; public bool[,] LandBitmap @@ -268,6 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Land { LandData = landData.Copy(); m_scene = scene; + m_dwellModule = m_scene.RequestModuleInterface(); } public LandObject(UUID owner_id, bool is_group_owned, Scene scene, LandData data = null) @@ -276,7 +278,10 @@ namespace OpenSim.Region.CoreModules.World.Land if (m_scene == null) LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; else + { LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; + m_dwellModule = m_scene.RequestModuleInterface(); + } if(data == null) LandData = new LandData(); @@ -1819,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.World.Land } // need to update dwell here bc landdata has no parent info - if(LandData != null) + if(LandData != null && m_dwellModule != null) { double now = Util.GetTimeStampMS(); double elapsed = now - LandData.LastDwellTimeMS; -- cgit v1.1 From 92df6095d5aed4f008dfdad7a597e72fdc70217d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 05:49:01 +0100 Subject: don't round to nearest int --- OpenSim/Region/CoreModules/World/Land/DwellModule.cs | 4 ++-- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index 55a341e..22480e6 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -130,14 +130,14 @@ namespace OpenSim.Region.CoreModules.World.Land { ILandObject parcel = m_scene.LandChannel.GetLandObject(parcelID); if (parcel != null && parcel.LandData != null) - return (int)(parcel.LandData.Dwell + 0.5f); + return (int)(parcel.LandData.Dwell); return 0; } public int GetDwell(LandData land) { if (land != null) - return (int)(land.Dwell + 0.5f); + return (int)(land.Dwell); return 0; } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 9affe7d..ccb85f6 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -1849,7 +1849,7 @@ namespace OpenSim.Region.CoreModules.World.Land float newdwell = (float)(cur * 1.666666666667e-5); LandData.Dwell = newdwell; - if(Math.Abs(newdwell - dwell) > 1.0) + if(Math.Abs(newdwell - dwell) >= 0.9) m_scene.EventManager.TriggerLandObjectAdded(this); } } -- cgit v1.1 From 156707edfb88b9ddf679751f8f6d8128b2abd7be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 May 2017 06:27:29 +0100 Subject: clear land object on delete --- OpenSim/Framework/ILandObject.cs | 2 ++ .../Region/CoreModules/World/Land/LandManagementModule.cs | 6 +++++- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index f3b850d..a783256 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -189,5 +189,7 @@ namespace OpenSim.Framework /// /// The music url. string GetMusicUrl(); + + void Clear(); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 6f32a77..057e204 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -274,6 +274,9 @@ namespace OpenSim.Region.CoreModules.World.Land //Remove all the land objects in the sim and add a blank, full sim land object set to public lock (m_landList) { + foreach(ILandObject parcel in m_landList.Values) + parcel.Clear(); + m_landList.Clear(); m_landUUIDList.Clear(); m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; @@ -696,6 +699,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.Remove(local_id); if(land.LandData != null) m_landUUIDList.Remove(land.LandData.GlobalID); + land.Clear(); } m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID); @@ -746,7 +750,7 @@ namespace OpenSim.Region.CoreModules.World.Land } } } - + master.LandData.Dwell += slave.LandData.Dwell; removeLandObject(slave.LandData.LocalID); UpdateLandObject(master.LandData.LocalID, master.LandData); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index ccb85f6..b534a2b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -269,6 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Land { LandData = landData.Copy(); m_scene = scene; + m_scene.EventManager.OnFrame += OnFrame; m_dwellModule = m_scene.RequestModuleInterface(); } @@ -296,9 +297,20 @@ namespace OpenSim.Region.CoreModules.World.Land LandData.IsGroupOwned = is_group_owned; + if(m_dwellModule == null) + LandData.Dwell = 0; + m_scene.EventManager.OnFrame += OnFrame; } + public void Clear() + { + if(m_scene != null) + m_scene.EventManager.OnFrame -= OnFrame; + LandData = null; + } + + #endregion #region Member Functions -- cgit v1.1