fixing out-of-sync error in BaseHttpServer

0.6.5-rc1
Dr Scofield 2009-03-10 15:51:17 +00:00
parent 0df0258087
commit c6415ef71d
1 changed files with 19 additions and 16 deletions

View File

@ -499,26 +499,29 @@ namespace OpenSim.Framework.Servers
{ {
string bestMatch = null; 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)) if (String.IsNullOrEmpty(bestMatch))
{ {
streamHandler = null; streamHandler = null;
return false; return false;
} }
else else
{ {
streamHandler = m_streamHandlers[bestMatch]; streamHandler = m_streamHandlers[bestMatch];
return true; return true;
}
} }
} }
@ -1482,7 +1485,7 @@ namespace OpenSim.Framework.Servers
//m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); //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) public void RemoveHTTPHandler(string httpMethod, string path)