From e4bdaaaa832806cb23fe5121e34ab6fde2d8188c Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 9 Mar 2011 16:31:53 -0800 Subject: [PATCH] Added SyncStateReport function in RegionSyncModule to do some preliminary sync state comparison. --- .../SymmetricSync/RegionSyncModule.cs | 29 +++++++++++++++++++ .../Framework/Scenes/Scene.Inventory.cs | 5 +++- .../Shared/Api/Implementation/LSL_Api.cs | 6 ++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 56b0fef8c8..81c71ea2a2 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -590,10 +590,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //for debugging purpose Command cmdSyncDebug = new Command("debug", CommandIntentions.COMMAND_HAZARDOUS, SyncDebug, "Trigger some debugging functions"); + //for sync state comparison, + Command cmdSyncStateReport = new Command("state", CommandIntentions.COMMAND_HAZARDOUS, SyncStateReport, "Trigger synchronization state comparision functions"); + m_commander.RegisterCommand("start", cmdSyncStart); m_commander.RegisterCommand("stop", cmdSyncStop); m_commander.RegisterCommand("status", cmdSyncStatus); m_commander.RegisterCommand("debug", cmdSyncDebug); + m_commander.RegisterCommand("state", cmdSyncStateReport); lock (m_scene) { @@ -1174,6 +1178,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { //TO BE IMPLEMENTED m_log.Warn("[REGION SYNC MODULE]: SyncStatus() TO BE IMPLEMENTED !!!"); + + } + + private void SyncStateReport(Object[] args) + { + //Preliminary implementation + EntityBase[] entities = m_scene.GetEntities(); + List sogList = new List(); + foreach (EntityBase entity in entities) + { + if (entity is SceneObjectGroup) + { + sogList.Add((SceneObjectGroup)entity); + } + } + + int primCount = 0; + foreach (SceneObjectGroup sog in sogList) + { + primCount += sog.Parts.Length; + } + + m_log.WarnFormat("SyncStatus -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount); } private void SyncDebug(Object[] args) @@ -1613,6 +1640,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return data; } + /* private void HandleAddNewObject(SceneObjectGroup sog) { //RegionSyncModule only add object to SceneGraph. Any actor specific actions will be implemented @@ -1624,6 +1652,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.Debug(LogHeader + ": added obj " + sog.UUID); } } + * */ private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f1d16f7c13..8aa7c363af 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2194,7 +2194,10 @@ namespace OpenSim.Region.Framework.Scenes } AddNewSceneObject(group, true, pos, rot, vel); - + + //SYNC DEBUG + m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString()); + // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 22a18ed775..aaab3ba431 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3412,8 +3412,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api item = m_host.TaskInventory[invItemID]; } - if (agentID == UUID.Zero || perm == 0) // Releasing permissions - { + //if (agentID == UUID.Zero || perm == 0) // Releasing permissions + //{ llReleaseControls(); item.PermsGranter = UUID.Zero; @@ -3425,7 +3425,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new DetectParams[0])); return; - } + //} if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) llReleaseControls();