From e4f64dd7147001e1e0ac9bd4a51efec086727b29 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 20 Aug 2009 22:36:47 -0700
Subject: Made HandleFetchInventoryDescendents async, so that the client thread
 doesn't wait for the download of the entire inventory.

---
 .../Region/Framework/Scenes/Scene.PacketHandlers.cs   | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index d722e23..2b815a2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -441,9 +441,24 @@ namespace OpenSim.Region.Framework.Scenes
                 return;
             }
 
+            // We're going to send the reply async, because there may be
+            // an enormous quantity of packets -- basically the entire inventory!
+            // We don't want to block the client thread while all that is happening.
+            SendInventoryDelegate d = SendInventoryAsync;
+            d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);
+        }
+
+        delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
+
+        void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
+        {
             SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
-        }        
-        
+        }
+
+        void SendInventoryComplete(IAsyncResult iar)
+        {
+        }
+
         /// <summary>
         /// Handle the caps inventory descendents fetch.
         ///
-- 
cgit v1.1