소스 검색

Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

dahlia 10 년 전
부모
커밋
719810e9d8

+ 7 - 14
OpenSim/Framework/RegionSettings.cs

@@ -482,21 +482,14 @@ namespace OpenSim.Framework
             set { m_LoadedCreationID = value; }
         }
 
-        // Connected Telehub object
-        private UUID m_TelehubObject = UUID.Zero;
-        public UUID TelehubObject
-        {
-            get
-            {
-                return m_TelehubObject;
-            }
-            set
-            {
-                m_TelehubObject = value;
-            }
-        }
+        /// <summary>
+        /// Connected Telehub object
+        /// </summary>
+        public UUID TelehubObject { get; set; }
 
-        // Our Connected Telehub's SpawnPoints
+        /// <summary>
+        /// Our connected Telehub's SpawnPoints
+        /// </summary>
         public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
 
         // Add a SpawnPoint

+ 1 - 1
OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs

@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
         
         public void Initialise()
         {            
-            m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
+//            m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
             
             m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
                                "set terrain texture <number> <uuid> [<x>] [<y>]",

+ 5 - 3
OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs

@@ -702,7 +702,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
             }
         }
 
-        public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
+        public void HandleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
         {
             SceneObjectPart part;
 
@@ -742,7 +742,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
                 default:
                     break;
             }
-            SendTelehubInfo(client);
+
+            if (client != null)
+                SendTelehubInfo(client);
         }
 
         private void SendSimulatorBlueBoxMessage(
@@ -1214,7 +1216,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
             client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
             client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
             client.OnEstateChangeInfo += handleEstateChangeInfo;
-            client.OnEstateManageTelehub += handleOnEstateManageTelehub;
+            client.OnEstateManageTelehub += HandleOnEstateManageTelehub;
             client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
             client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
             client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;

+ 7 - 0
OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs

@@ -51,10 +51,17 @@ namespace OpenSim.Region.Framework.Interfaces
         UUID = 5
     }
     
+    public struct JsonStoreStats
+    {
+        public int StoreCount;
+    }
+
     public delegate void TakeValueCallback(string s);
 
     public interface IJsonStoreModule
     {
+        JsonStoreStats GetStoreStats();
+
         bool AttachObjectStore(UUID objectID);
         bool CreateStore(string value, ref UUID result);
         bool DestroyStore(UUID storeID);

+ 35 - 15
OpenSim/Region/Framework/Scenes/Scene.cs

@@ -3951,32 +3951,52 @@ namespace OpenSim.Region.Framework.Scenes
                     }
                 }
 
+//                m_log.DebugFormat(
+//                    "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", 
+//                    RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
+
                 // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags
                 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero &&
                     RegionInfo.EstateSettings.AllowDirectTeleport == false &&
                     !viahome && !godlike)
                 {
                     SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
-                    // Can have multiple SpawnPoints
-                    List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
-                    if (spawnpoints.Count > 1)
+
+                    if (telehub != null)
                     {
-                        // We have multiple SpawnPoints, Route the agent to a random or sequential one
-                        if (SpawnPointRouting == "random")
-                            acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
-                                telehub.AbsolutePosition,
-                                telehub.GroupRotation
-                            );
+                        // Can have multiple SpawnPoints
+                        List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
+                        if (spawnpoints.Count > 1)
+                        {
+                            // We have multiple SpawnPoints, Route the agent to a random or sequential one
+                            if (SpawnPointRouting == "random")
+                                acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
+                                    telehub.AbsolutePosition,
+                                    telehub.GroupRotation
+                                );
+                            else
+                                acd.startpos = spawnpoints[SpawnPoint()].GetLocation(
+                                    telehub.AbsolutePosition,
+                                    telehub.GroupRotation
+                                );
+                        }
+                        else if (spawnpoints.Count == 1)
+                        {
+                            // We have a single SpawnPoint and will route the agent to it
+                            acd.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
+                        }
                         else
-                            acd.startpos = spawnpoints[SpawnPoint()].GetLocation(
-                                telehub.AbsolutePosition,
-                                telehub.GroupRotation
-                            );
+                        {
+                            m_log.DebugFormat(
+                                "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}.  Continuing.", 
+                                RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
+                        }
                     }
                     else
                     {
-                        // We have a single SpawnPoint and will route the agent to it
-                        acd.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
+                        m_log.DebugFormat(
+                            "[SCENE]: No telehub {0} found to direct {1} in {2}.  Continuing.", 
+                            RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
                     }
 
                     return true;

+ 119 - 0
OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs

@@ -0,0 +1,119 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.World.Estate;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Services.Interfaces;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+
+namespace OpenSim.Region.Framework.Scenes.Tests
+{
+    /// <summary>
+    /// Scene telehub tests
+    /// </summary>
+    /// <remarks>
+    /// TODO: Tests which run through normal functionality.  Currently, the only test is one that checks behaviour
+    /// in the case of an error condition
+    /// </remarks>
+    [TestFixture]
+    public class SceneTelehubTests : OpenSimTestCase
+    {
+        /// <summary>
+        /// Test for desired behaviour when a telehub has no spawn points
+        /// </summary>
+        [Test]
+        public void TestNoTelehubSpawnPoints()
+        {
+            TestHelpers.InMethod();
+//            TestHelpers.EnableLogging();
+
+            EstateManagementModule emm = new EstateManagementModule();
+
+            SceneHelpers sh = new SceneHelpers();
+            Scene scene = sh.SetupScene();
+            SceneHelpers.SetupSceneModules(scene, emm);
+
+            UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
+
+            SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
+
+            emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
+            scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
+
+            // Must still be possible to successfully log in
+            UUID loggingInUserId = TestHelpers.ParseTail(0x2);
+
+            UserAccount ua 
+                = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
+
+            SceneHelpers.AddScenePresence(scene, ua);
+
+            Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
+        }
+
+        /// <summary>
+        /// Test for desired behaviour when the scene object nominated as a telehub object does not exist.
+        /// </summary>
+        [Test]
+        public void TestNoTelehubSceneObject()
+        {
+            TestHelpers.InMethod();
+//            TestHelpers.EnableLogging();
+
+            EstateManagementModule emm = new EstateManagementModule();
+
+            SceneHelpers sh = new SceneHelpers();
+            Scene scene = sh.SetupScene();
+            SceneHelpers.SetupSceneModules(scene, emm);
+
+            UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
+
+            SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
+            SceneObjectGroup spawnPointSo = SceneHelpers.AddSceneObject(scene, "spawnpointObject", telehubSceneObjectOwner);
+
+            emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
+            emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "spawnpoint add", spawnPointSo.LocalId);
+            scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
+
+            scene.DeleteSceneObject(telehubSo, false);
+
+            // Must still be possible to successfully log in
+            UUID loggingInUserId = TestHelpers.ParseTail(0x2);
+
+            UserAccount ua 
+                = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
+
+            SceneHelpers.AddScenePresence(scene, ua);
+
+            Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
+        }
+    }
+}

+ 195 - 0
OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs

@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) Contributors 
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSim Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+using Mono.Addins;
+
+using System;
+using System.Reflection;
+using System.Threading;
+using System.Text;
+using System.Net;
+using System.Net.Sockets;
+using log4net;
+using Nini.Config;
+using OpenMetaverse;
+using OpenMetaverse.StructuredData;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
+{
+    [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreCommandsModule")]
+
+    public class JsonStoreCommandsModule  : INonSharedRegionModule
+    {
+        private static readonly ILog m_log =
+            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        private IConfig m_config = null;
+        private bool m_enabled = false;
+
+        private Scene m_scene = null;
+        //private IJsonStoreModule m_store;
+        private JsonStoreModule m_store;
+
+#region Region Module interface
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// Name of this shared module is it's class name
+        /// </summary>
+        // -----------------------------------------------------------------
+        public string Name
+        {
+            get { return this.GetType().Name; }
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// Initialise this shared module
+        /// </summary>
+        /// <param name="scene">this region is getting initialised</param>
+        /// <param name="source">nini config, we are not using this</param>
+        // -----------------------------------------------------------------
+        public void Initialise(IConfigSource config)
+        {
+            try 
+            {
+                if ((m_config = config.Configs["JsonStore"]) == null)
+                {
+                    // There is no configuration, the module is disabled
+                    // m_log.InfoFormat("[JsonStore] no configuration info");
+                    return;
+                }
+
+                m_enabled = m_config.GetBoolean("Enabled", m_enabled);
+            }
+            catch (Exception e)
+            {
+                m_log.Error("[JsonStore]: initialization error: {0}", e);
+                return;
+            }
+
+            if (m_enabled)
+                m_log.DebugFormat("[JsonStore]: module is enabled");
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// everything is loaded, perform post load configuration
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void PostInitialise()
+        {
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// Nothing to do on close
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void Close()
+        {
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void AddRegion(Scene scene)
+        {
+            if (m_enabled)
+            {
+                m_scene = scene;
+                
+            }
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void RemoveRegion(Scene scene)
+        {
+            // need to remove all references to the scene in the subscription
+            // list to enable full garbage collection of the scene object
+        }
+
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// Called when all modules have been added for a region. This is 
+        /// where we hook up events
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void RegionLoaded(Scene scene)
+        {
+            if (m_enabled)
+            {
+                m_scene = scene;
+
+                m_store = (JsonStoreModule) m_scene.RequestModuleInterface<IJsonStoreModule>();
+                if (m_store == null)
+                {
+                    m_log.ErrorFormat("[JsonStoreCommands]: JsonModule interface not defined");
+                    m_enabled = false;
+                    return;
+                }
+
+                scene.AddCommand("JsonStore", this, "jsonstore stats", "jsonstore stats",
+                                 "Display statistics about the state of the JsonStore module", "",
+                                 CmdStats);
+            }
+        }
+
+        /// -----------------------------------------------------------------
+        /// <summary>
+        /// </summary>
+        // -----------------------------------------------------------------
+        public Type ReplaceableInterface
+        {
+            get { return null; }
+        }
+
+#endregion
+
+#region Commands
+
+        private void CmdStats(string module, string[] cmd)
+        {
+            if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null)
+                return;
+
+            JsonStoreStats stats = m_store.GetStoreStats();
+            MainConsole.Instance.OutputFormat("{0}\t{1}",m_scene.RegionInfo.RegionName,stats.StoreCount);
+        }
+
+#endregion
+
+    }
+}

+ 39 - 2
OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs

@@ -42,7 +42,6 @@ using OpenSim.Region.Framework.Scenes;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
 
-            
 namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
 {
     [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "JsonStoreModule")]
@@ -60,6 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         private Scene m_scene = null;
 
         private Dictionary<UUID,JsonStore> m_JsonValueStore;
+
         private UUID m_sharedStore;
 
 #region Region Module interface
@@ -140,6 +140,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
                 m_sharedStore = UUID.Zero;
                 m_JsonValueStore = new Dictionary<UUID,JsonStore>();
                 m_JsonValueStore.Add(m_sharedStore,new JsonStore(""));
+
+                scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
             }
         }
 
@@ -149,6 +151,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         // -----------------------------------------------------------------
         public void RemoveRegion(Scene scene)
         {
+            scene.EventManager.OnObjectBeingRemovedFromScene -= EventManagerOnObjectBeingRemovedFromScene;
+
             // need to remove all references to the scene in the subscription
             // list to enable full garbage collection of the scene object
         }
@@ -161,7 +165,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         // -----------------------------------------------------------------
         public void RegionLoaded(Scene scene)
         {
-            if (m_enabled) {}
+            if (m_enabled)
+            {
+            }
         }
 
         /// -----------------------------------------------------------------
@@ -175,8 +181,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
 
 #endregion
 
+#region SceneEvents
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// 
+        /// </summary>
+        // -----------------------------------------------------------------
+        public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
+        {
+            obj.ForEachPart(delegate(SceneObjectPart sop) { DestroyStore(sop.UUID); } );
+        }
+
+#endregion
+
 #region ScriptInvocationInteface
 
+        
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// 
+        /// </summary>
+        // -----------------------------------------------------------------
+        public JsonStoreStats GetStoreStats()
+        {
+            JsonStoreStats stats;
+
+            lock (m_JsonValueStore)
+            {
+                stats.StoreCount = m_JsonValueStore.Count;
+            }
+            
+            return stats;
+        }
+        
         // -----------------------------------------------------------------
         /// <summary>
         /// 

+ 40 - 1
OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs

@@ -59,7 +59,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
 
         private IScriptModuleComms m_comms;
         private IJsonStoreModule m_store;
-        
+
+        private Dictionary<UUID,HashSet<UUID>> m_scriptStores = new Dictionary<UUID,HashSet<UUID>>();
+
 #region Region Module interface
 
         // -----------------------------------------------------------------
@@ -126,6 +128,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         // -----------------------------------------------------------------
         public void AddRegion(Scene scene)
         {
+            scene.EventManager.OnScriptReset += HandleScriptReset;
+            scene.EventManager.OnRemoveScript += HandleScriptReset;
         }
 
         // -----------------------------------------------------------------
@@ -134,10 +138,32 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         // -----------------------------------------------------------------
         public void RemoveRegion(Scene scene)
         {
+            scene.EventManager.OnScriptReset -= HandleScriptReset;
+            scene.EventManager.OnRemoveScript -= HandleScriptReset;
+
             // need to remove all references to the scene in the subscription
             // list to enable full garbage collection of the scene object
         }
 
+        // -----------------------------------------------------------------
+        /// <summary>
+        /// </summary>
+        // -----------------------------------------------------------------
+        private void HandleScriptReset(uint localID, UUID itemID)
+        {
+            HashSet<UUID> stores;
+
+            lock (m_scriptStores)
+            {
+                if (! m_scriptStores.TryGetValue(itemID, out stores))
+                    return;
+                m_scriptStores.Remove(itemID);
+            }
+
+            foreach (UUID id in stores)
+                m_store.DestroyStore(id);
+        }
+
         // -----------------------------------------------------------------
         /// <summary>
         /// Called when all modules have been added for a region. This is 
@@ -250,6 +276,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
             if (! m_store.CreateStore(value, ref uuid))
                 GenerateRuntimeError("Failed to create Json store");
             
+            lock (m_scriptStores)
+            {
+                if (! m_scriptStores.ContainsKey(scriptID))
+                    m_scriptStores[scriptID] = new HashSet<UUID>();
+                
+                m_scriptStores[scriptID].Add(uuid);
+            }
             return uuid;
         }
 
@@ -261,6 +294,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
         [ScriptInvocation]
         public int JsonDestroyStore(UUID hostID, UUID scriptID, UUID storeID)
         {
+            lock(m_scriptStores)
+            {
+                if (m_scriptStores.ContainsKey(scriptID))
+                    m_scriptStores[scriptID].Remove(storeID);
+            }
+
             return m_store.DestroyStore(storeID) ? 1 : 0;
         }
 

+ 0 - 5
OpenSim/Tests/Common/Mock/TestClient.cs

@@ -788,11 +788,6 @@ namespace OpenSim.Tests.Common.Mock
             {
                 OnRegionHandShakeReply(this);
             }
-
-            if (OnCompleteMovementToRegion != null)
-            {
-                OnCompleteMovementToRegion(this, true);
-            }
         }
         
         public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)

+ 19 - 2
OpenSim/Tests/Common/TestHelpers.cs

@@ -117,8 +117,6 @@ namespace OpenSim.Tests.Common
         /// Parse a UUID stem into a full UUID.
         /// </summary>
         /// <remarks>
-        /// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it,
-        /// UUIDs are conceptually not hexadecmial numbers.
         /// The fragment will come at the start of the UUID.  The rest will be 0s
         /// </remarks>
         /// <returns></returns>
@@ -143,5 +141,24 @@ namespace OpenSim.Tests.Common
         {
             return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail));
         }
+
+        /// <summary>
+        /// Parse a UUID tail section into a full UUID.
+        /// </summary>
+        /// <remarks>
+        /// The fragment will come at the end of the UUID.  The rest will be 0s
+        /// </remarks>
+        /// <returns></returns>
+        /// <param name='frag'>
+        /// A UUID fragment that will be parsed into a full UUID.  Therefore, it can only contain
+        /// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is
+        /// given as the 'fragment'.
+        /// </param>
+        public static UUID ParseTail(string stem)
+        {
+            string rawUuid = stem.PadLeft(32, '0');
+
+            return UUID.Parse(rawUuid);           
+        }
     }
 }