From 6f077d5e5f9929f6593850dc096983dcf237e387 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Wed, 26 Aug 2009 21:05:46 -0400 Subject: * Another attempt at fixing the random spurious test error. * This time it might be the listening socket thread from HttpServer aborting with a non blocking thread abort exception. Hopefully calling Stop() on MainServer.Instance will solve that. --- .../Tests/Cache/UserProfileCacheServiceTests.cs | 11 +++++++++++ .../Communications/Tests/LoginServiceTests.cs | 10 ++++++++++ .../Framework/Servers/HttpServer/BaseHttpServer.cs | 19 +++++++++++++------ 3 files changed, 34 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 933fa12..2bb0926 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs @@ -330,5 +330,16 @@ namespace OpenSim.Framework.Communications.Tests Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null); } + + [TearDown] + public void TearDown() + { + try + { + if (MainServer.Instance != null) MainServer.Instance.Stop(); + } + catch (System.NullReferenceException) + { } + } } } \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 57a908e..0a9d2ae 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -362,6 +362,16 @@ namespace OpenSim.Framework.Communications.Tests //Console.WriteLine("Finished T023_TestAuthenticatedLoginAlreadyLoggedIn()"); } + [TearDown] + public void TearDown() + { + try + { + if (MainServer.Instance != null) MainServer.Instance.Stop(); + } catch (NullReferenceException) + {} + } + public class TestLoginToRegionConnector : ILoginServiceToRegionsConnector { private List m_regionsList = new List(); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 75c9310..771ae05 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1637,13 +1637,20 @@ namespace OpenSim.Framework.Servers.HttpServer public void Stop() { HTTPDRunning = false; - m_httpListener2.ExceptionThrown -= httpServerException; - //m_httpListener2.DisconnectHandler = null; - - m_httpListener2.LogWriter = null; - m_httpListener2.RequestReceived -= OnRequest; + try + { + m_httpListener2.ExceptionThrown -= httpServerException; + //m_httpListener2.DisconnectHandler = null; - m_httpListener2.Stop(); + m_httpListener2.LogWriter = null; + m_httpListener2.RequestReceived -= OnRequest; + m_httpListener2.Stop(); + } + catch (NullReferenceException) + { + m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer."); + } + } public void RemoveStreamHandler(string httpMethod, string path) -- cgit v1.1