diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index d0e88f697f..4c85637068 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver SaveAssets = true; } - protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) + protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut) { Exception reportedException = null; bool succeeded = true; @@ -143,6 +143,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_saveStream.Close(); } + if (timedOut) + { + succeeded = false; + reportedException = new Exception("Loading assets timed out"); + } + m_module.TriggerInventoryArchiveSaved( m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); } @@ -350,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { m_log.DebugFormat("[INVENTORY ARCHIVER]: Not saving assets since --noassets was specified"); - ReceivedAllAssets(new List(), new List()); + ReceivedAllAssets(new List(), new List(), false); } } catch (Exception) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 7bdd65c60b..367693d00d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs @@ -587,19 +587,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } - protected void ReceivedAllAssets( - ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) + protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut) { - foreach (UUID uuid in assetsNotFoundUuids) + string errorMessage; + + if (timedOut) { - m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); + errorMessage = "Loading assets timed out"; } + else + { + foreach (UUID uuid in assetsNotFoundUuids) + { + m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); + } - // m_log.InfoFormat( - // "[ARCHIVER]: Received {0} of {1} assets requested", - // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); + // m_log.InfoFormat( + // "[ARCHIVER]: Received {0} of {1} assets requested", + // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); - CloseArchive(String.Empty); + errorMessage = String.Empty; + } + + CloseArchive(errorMessage); } /// @@ -626,4 +636,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs index 95d109c5a0..c1ff94dae0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs @@ -150,12 +150,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", m_assetsWritten); } - /// - /// Only call this if you need to force a close on the underlying writer. - /// - public void ForceClose() - { - m_archiveWriter.Close(); - } } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 103eb4792b..b22bcf971d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// Method called when all the necessary assets for an archive request have been received. /// public delegate void AssetsRequestCallback( - ICollection assetsFoundUuids, ICollection assetsNotFoundUuids); + ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut); enum RequestState { @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (m_repliesRequired == 0) { m_requestState = RequestState.Completed; - PerformAssetsRequestCallback(null); + PerformAssetsRequestCallback(false); return; } @@ -164,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) { - bool close = true; + bool timedOut = true; try { @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // the final request came in (assuming that such a thing is possible) if (m_requestState == RequestState.Completed) { - close = false; + timedOut = false; return; } @@ -223,8 +223,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } finally { - if (close) - m_assetsArchiver.ForceClose(); + if (timedOut) + Util.FireAndForget(PerformAssetsRequestCallback, true); } } @@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // We want to stop using the asset cache thread asap // as we now need to do the work of producing the rest of the archive - Util.FireAndForget(PerformAssetsRequestCallback); + Util.FireAndForget(PerformAssetsRequestCallback, false); } else { @@ -315,9 +315,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Culture.SetCurrentCulture(); + Boolean timedOut = (Boolean)o; + try { - m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids); + m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids, timedOut); } catch (Exception e) {