From 10d923dbeaa3eac8d085ab14bb8fab4a71e1fd29 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Tue, 11 Aug 2009 16:47:36 -0700
Subject: Fixes a race condition in EQ processing that was making EQs pop up
 again upon client close. Commented remote call on GetSystemFolders again, so
 that it's not live yet.

---
 .../Agent/Capabilities/CapabilitiesModule.cs       |  2 +-
 .../Framework/EventQueue/EventQueueGetModule.cs    | 20 +++++++++-------
 .../Framework/Scenes/SceneCommunicationService.cs  | 24 +++++++++----------
 .../Inventory/InventoryServiceConnector.cs         | 28 +++++++++++-----------
 4 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index 56545d6..0c6900d 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
 
         public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
         {
-            //m_log.Debug(" !!! Setting child seeds in {0} to {1}", RegionInfo.RegionName, value.Count);
+            //m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
             childrenSeeds[agentID] = seeds;
         }
 
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 8230401..34d46a0 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -328,15 +328,19 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
 
         public bool HasEvents(UUID agentID)
         {
-            Queue<OSD> queue = TryGetQueue(agentID);
-            lock (queue)
-            {
-                if (queue.Count > 0)
-                    return true;
-                else
-                    return false;
-            }
+            // Don't use this, because of race conditions at agent closing time
+            //Queue<OSD> queue = TryGetQueue(agentID);
 
+            Queue<OSD> queue = GetQueue(agentID);
+            if (queue != null)
+                lock (queue)
+                {
+                    if (queue.Count > 0)
+                        return true;
+                    else
+                        return false;
+                }
+            return false;
         }
 
         public Hashtable GetEvents(UUID pAgentId, string request)
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 4f2b6ec..0140faa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1319,17 +1319,17 @@ namespace OpenSim.Region.Framework.Scenes
             return m_commsProvider.GridService.RequestNamedRegions(name, maxNumber);
         }
 
-//        private void Dump(string msg, List<ulong> handles)
-//        {
-//            m_log.Info"-------------- HANDLE DUMP ({0}) ---------", msg);
-//            foreach (ulong handle in handles)
-//            {
-//                uint x, y;
-//                Utils.LongToUInts(handle, out x, out y);
-//                x = x / Constants.RegionSize;
-//                y = y / Constants.RegionSize;
-//                m_log.Info("({0}, {1})", x, y);
-//            }
-//        }
+        //private void Dump(string msg, List<ulong> handles)
+        //{
+        //    m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
+        //    foreach (ulong handle in handles)
+        //    {
+        //        uint x, y;
+        //        Utils.LongToUInts(handle, out x, out y);
+        //        x = x / Constants.RegionSize;
+        //        y = y / Constants.RegionSize;
+        //        m_log.InfoFormat("({0}, {1})", x, y);
+        //    }
+        //}
     }
 }
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index 2244a7e..e41b427 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -164,20 +164,20 @@ namespace OpenSim.Services.Connectors
         public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
         {
             // !!! Not just yet.
-            try
-            {
-                List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
-                    "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
-                Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
-                foreach (InventoryFolderBase f in folders)
-                    dFolders[(AssetType)f.Type] = f;
-                return dFolders;
-            }
-            catch (Exception e)
-            {
-                m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
-                     e.Source, e.Message);
-            }
+            //try
+            //{
+            //    List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
+            //        "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
+            //    Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
+            //    foreach (InventoryFolderBase f in folders)
+            //        dFolders[(AssetType)f.Type] = f;
+            //    return dFolders;
+            //}
+            //catch (Exception e)
+            //{
+            //    m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
+            //         e.Source, e.Message);
+            //}
 
             return new Dictionary<AssetType, InventoryFolderBase>();
         }
-- 
cgit v1.1