From 4382f28efc6ffe70e3c6f6e8cd7e7c729d1f12af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 00:33:02 -0700 Subject: Async purge so that the client thread doesn't wait. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index a2414e5..77b980c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Threading; using OpenMetaverse; @@ -558,15 +559,34 @@ namespace OpenSim.Region.Framework.Scenes /// /// + delegate void PurgeFolderDelegate(UUID userID, UUID folder); + public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) { - InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); + PurgeFolderDelegate d = PurgeFolderAsync; + try + { + d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d); + } + catch (Exception e) + { + m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message); + } + } + + + private void PurgeFolderAsync(UUID userID, UUID folderID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID, userID); if (InventoryService.PurgeFolder(folder)) m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); else m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); - } + } + private void PurgeFolderCompleted(IAsyncResult iar) + { + } } } -- cgit v1.1