From c6415ef71da44a5a6bba725ed1f6d24c0056ef97 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Tue, 10 Mar 2009 15:51:17 +0000 Subject: fixing out-of-sync error in BaseHttpServer --- OpenSim/Framework/Servers/BaseHttpServer.cs | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 361f895..617dcae 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -499,26 +499,29 @@ namespace OpenSim.Framework.Servers { string bestMatch = null; - foreach (string pattern in m_streamHandlers.Keys) + lock (m_streamHandlers) { - if (handlerKey.StartsWith(pattern)) + foreach (string pattern in m_streamHandlers.Keys) { - if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) + if (handlerKey.StartsWith(pattern)) { - bestMatch = pattern; + if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) + { + bestMatch = pattern; + } } } - } - - if (String.IsNullOrEmpty(bestMatch)) - { - streamHandler = null; - return false; - } - else - { - streamHandler = m_streamHandlers[bestMatch]; - return true; + + if (String.IsNullOrEmpty(bestMatch)) + { + streamHandler = null; + return false; + } + else + { + streamHandler = m_streamHandlers[bestMatch]; + return true; + } } } @@ -1482,7 +1485,7 @@ namespace OpenSim.Framework.Servers //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); - m_streamHandlers.Remove(handlerKey); + lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); } public void RemoveHTTPHandler(string httpMethod, string path) -- cgit v1.1