From 5c3f88b64d52559283637079754760a835435d92 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 22 Nov 2015 07:55:49 +0000 Subject: take the Monitor.wait out of the locks --- .../World/Archiver/Tests/ArchiverTests.cs | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 9de5c43..7211d38 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -200,10 +200,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests m_archiverModule.ArchiveRegion(archiveWriteStream, requestId); //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; //while (assetServer.HasWaitingRequests()) - // assetServer.ProcessNextRequest(); - - Monitor.Wait(this, 60000); + // assetServer.ProcessNextRequest(); } + + Monitor.Wait(this, 60000); Assert.That(m_lastRequestId, Is.EqualTo(requestId)); @@ -401,9 +401,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { m_scene.EventManager.OnOarFileLoaded += LoadCompleted; m_archiverModule.DearchiveRegion(archiveReadStream); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); Assert.That(m_lastErrorMessage, Is.Null); TestLoadedRegion(part1, soundItemName, soundData); @@ -451,8 +451,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { m_scene.EventManager.OnOarFileLoaded += LoadCompleted; m_archiverModule.DearchiveRegion(archiveReadStream); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); Assert.That(m_lastErrorMessage, Is.Null); @@ -501,11 +501,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests lock (this) { m_archiverModule.ArchiveRegion( - archiveWriteStream, requestId, new Dictionary() { { "wipe-owners", Boolean.TrueString } }); - - Monitor.Wait(this, 60000); + archiveWriteStream, requestId, new Dictionary() { { "wipe-owners", Boolean.TrueString } }); } - + Monitor.Wait(this, 60000); + Assert.That(m_lastRequestId, Is.EqualTo(requestId)); byte[] archive = archiveWriteStream.ToArray(); @@ -535,6 +534,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests scene2.EventManager.OnOarFileLoaded += LoadCompleted; archiverModule.DearchiveRegion(archiveReadStream); } + Monitor.Wait(this, 60000); Assert.That(m_lastErrorMessage, Is.Null); @@ -600,6 +600,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests m_scene.EventManager.OnOarFileLoaded += LoadCompleted; m_archiverModule.DearchiveRegion(oarStream); } + Monitor.Wait(this, 60000); ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16); LandData rLd = rLo.LandData; @@ -671,8 +672,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { m_scene.EventManager.OnOarFileLoaded += LoadCompleted; m_archiverModule.DearchiveRegion(archiveReadStream); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); Assert.That(m_lastErrorMessage, Is.Null); RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings; @@ -742,13 +743,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); // Write out this scene - scene.EventManager.OnOarFileSaved += SaveCompleted; lock (this) { + scene.EventManager.OnOarFileSaved += SaveCompleted; m_archiverModule.ArchiveRegion(archiveWriteStream); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); } { @@ -765,8 +766,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Dictionary archiveOptions = new Dictionary(); archiveOptions.Add("merge", null); m_archiverModule.DearchiveRegion(archiveReadStream, Guid.Empty, archiveOptions); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); @@ -839,7 +840,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests // Save OAR MemoryStream archiveWriteStream = new MemoryStream(); - m_scene.EventManager.OnOarFileSaved += SaveCompleted; Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); @@ -848,9 +848,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests lock (this) { + m_scene.EventManager.OnOarFileSaved += SaveCompleted; m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); // Check that the OAR contains the expected data @@ -1023,8 +1024,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Dictionary archiveOptions = new Dictionary(); archiveOptions.Add("merge", null); m_archiverModule.DearchiveRegion(archiveReadStream, Guid.Empty, archiveOptions); - Monitor.Wait(this, 60000); } + Monitor.Wait(this, 60000); Assert.That(m_lastErrorMessage, Is.Null); -- cgit v1.1