From c4ae9413f1658d6b8cb42b6e382592c91e060f7b Mon Sep 17 00:00:00 2001 From: Chris Hart Date: Wed, 2 Sep 2009 21:42:41 +0100 Subject: MSSQL Minor tweak to recent patch for region loading (Thanks Grumly57 for spotting it!) --- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index c9e4bfe..adedcce 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs @@ -210,6 +210,7 @@ namespace OpenSim.Data.MSSQL { foreach (SceneObjectPart objectPart in allPrimsWithInventory) { + command.Parameters.Clear(); command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); List inventory = new List(); -- cgit v1.1 From 64fa23df7c1ab196ec1b901839e71837403b29ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 3 Sep 2009 19:41:38 +0100 Subject: If a test dll fails, stop immediately rather than trying all the other test dlls This is very useful behaviour if debugging test failures otherwise it's hard to pick out the test output Also, some minor method shuffling in the iar module --- .../Archiver/InventoryArchiveWriteRequest.cs | 5 ++- .../Inventory/Archiver/InventoryArchiverModule.cs | 51 +++++++++++----------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 4ee90e2..f73a7e3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -199,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryFolderImpl inventoryFolder = null; InventoryItemBase inventoryItem = null; + /* if (!m_userInfo.HasReceivedInventory) { // If the region server has access to the user admin service (by which users are created), @@ -220,13 +221,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_userInfo.FetchInventory(); } } + */ bool foundStar = false; // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl // itself (possibly at a small loss in efficiency). string[] components - = m_invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); + = m_invPath.Split( + new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); int maxComponentIndex = components.Length - 1; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index d3ba5fe..c495e02 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// private Dictionary m_scenes = new Dictionary(); private Scene m_aScene; + /// /// The comms manager we will use for all comms requests /// @@ -110,8 +111,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; if (handlerInventoryArchiveSaved != null) handlerInventoryArchiveSaved(succeeded, userInfo, invPath, saveStream, reportedException); + } + + public void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream) + { + if (m_scenes.Count > 0) + { + CachedUserInfo userInfo = GetUserInfo(firstName, lastName); + + if (userInfo != null) + new InventoryArchiveWriteRequest(this, userInfo, invPath, saveStream).Execute(); + } + } + + public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath) + { + if (m_scenes.Count > 0) + { + CachedUserInfo userInfo = GetUserInfo(firstName, lastName); + + if (userInfo != null) + new InventoryArchiveWriteRequest(this, userInfo, invPath, savePath).Execute(); + } } - + public void DearchiveInventory(string firstName, string lastName, string invPath, Stream loadStream) { if (m_scenes.Count > 0) @@ -125,18 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); } } - } - - public void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream) - { - if (m_scenes.Count > 0) - { - CachedUserInfo userInfo = GetUserInfo(firstName, lastName); - - if (userInfo != null) - new InventoryArchiveWriteRequest(this, userInfo, invPath, saveStream).Execute(); - } - } + } public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath) { @@ -151,18 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UpdateClientWithLoadedNodes(userInfo, request.Execute()); } } - } - - public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath) - { - if (m_scenes.Count > 0) - { - CachedUserInfo userInfo = GetUserInfo(firstName, lastName); - - if (userInfo != null) - new InventoryArchiveWriteRequest(this, userInfo, invPath, savePath).Execute(); - } - } + } /// /// Load inventory from an inventory file archive -- cgit v1.1 From 584c1138361c6c5ed3ad18225760fb5f9e88093a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 1 Sep 2009 11:26:08 -0700 Subject: Added Util.FireAndForget(), to replace leaking calls to Delegate.BeginInvoke() --- OpenSim/Framework/Util.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index bbb0ae2..58344f3 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1169,5 +1169,27 @@ namespace OpenSim.Framework return found.ToArray(); } + + #region FireAndForget Threading Pattern + + public static void FireAndForget(System.Threading.WaitCallback callback) + { + callback.BeginInvoke(null, EndFireAndForget, callback); + } + + public static void FireAndForget(System.Threading.WaitCallback callback, object obj) + { + callback.BeginInvoke(obj, EndFireAndForget, callback); + } + + private static void EndFireAndForget(IAsyncResult ar) + { + System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState; + + callback.EndInvoke(ar); + ar.AsyncWaitHandle.Close(); + } + + #endregion FireAndForget Threading Pattern } } -- cgit v1.1 From 33133e23b12781e71b499fcaa41bcad6374c6656 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 1 Sep 2009 12:07:48 -0700 Subject: Fixes seven leaky .BeginInvoke() calls --- .../Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | 2 +- .../ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 4 ++++ OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | 2 +- OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | 2 ++ OpenSim/Services/InventoryService/InventoryService.cs | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 621e9d2..7b4e374 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (asset != null) { - handler.BeginInvoke(id, sender, asset, null, null); + Util.FireAndForget(delegate { handler(id, sender, asset); }); return true; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index b13a116..fd3aaf4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (asset != null) { - handler.BeginInvoke(id, sender, asset, null, null); + Util.FireAndForget(delegate { handler(id, sender, asset); }); return true; } @@ -219,8 +219,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); - - handler.BeginInvoke(assetID, s, a, null, null); + + Util.FireAndForget(delegate { handler(assetID, s, a); }); }); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 55b100b..fddba86 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -457,6 +457,8 @@ namespace OpenSim.Region.Framework.Scenes void SendInventoryComplete(IAsyncResult iar) { + SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; + d.EndInvoke(iar); } /// @@ -622,6 +624,8 @@ namespace OpenSim.Region.Framework.Scenes private void PurgeFolderCompleted(IAsyncResult iar) { + PurgeFolderDelegate d = (PurgeFolderDelegate)iar.AsyncState; + d.EndInvoke(iar); } } } diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index d9748d4..ffc8e4c 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -177,7 +177,7 @@ namespace OpenSim.Services.Connectors } else { - handler.BeginInvoke(id, sender, asset, null, null); + Util.FireAndForget(delegate { handler(id, sender, asset); }); } return true; diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index a2261ba..cef678d 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -461,6 +461,8 @@ namespace OpenSim.Services.Connectors private void MoveItemsCompleted(IAsyncResult iar) { + MoveItemsDelegate d = (MoveItemsDelegate)iar.AsyncState; + d.EndInvoke(iar); } public bool MoveItems(string userID, List items, UUID sessionID) diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index f04754b..b98e256 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -232,7 +232,7 @@ namespace OpenSim.Services.InventoryService m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID); } - callback.BeginInvoke(folders, items, null, null); + Util.FireAndForget(delegate { callback(folders, items); }); } public InventoryCollection GetFolderContent(UUID userID, UUID folderID) -- cgit v1.1