* Lock http handlers dictionary in other places as well to avoid race conditions

* No adverse effects on a quick multi-machine grid test
0.6.5-rc1
Justin Clarke Casey 2009-03-19 17:07:00 +00:00
parent 1e6056c24b
commit b05be5b06b
1 changed files with 56 additions and 47 deletions

View File

@ -549,6 +549,8 @@ namespace OpenSim.Framework.Servers
string bestMatch = null; string bestMatch = null;
lock (m_HTTPHandlers)
{
foreach (string pattern in m_HTTPHandlers.Keys) foreach (string pattern in m_HTTPHandlers.Keys)
{ {
if (handlerKey.StartsWith(pattern)) if (handlerKey.StartsWith(pattern))
@ -571,6 +573,7 @@ namespace OpenSim.Framework.Servers
return true; return true;
} }
} }
}
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
{ {
@ -925,6 +928,8 @@ namespace OpenSim.Framework.Servers
//m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
lock (m_HTTPHandlers)
{
foreach (string pattern in m_HTTPHandlers.Keys) foreach (string pattern in m_HTTPHandlers.Keys)
{ {
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length) if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
@ -946,6 +951,7 @@ namespace OpenSim.Framework.Servers
return true; return true;
} }
} }
}
private bool TryGetLLSDHandler(string path, out LLSDMethod llsdHandler) private bool TryGetLLSDHandler(string path, out LLSDMethod llsdHandler)
{ {
@ -1214,6 +1220,8 @@ namespace OpenSim.Framework.Servers
// m_log.DebugFormat( // m_log.DebugFormat(
// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);
lock (m_HTTPHandlers)
{
foreach (string pattern in m_HTTPHandlers.Keys) foreach (string pattern in m_HTTPHandlers.Keys)
{ {
if (searchquery.ToLower().StartsWith(pattern.ToLower())) if (searchquery.ToLower().StartsWith(pattern.ToLower()))
@ -1242,6 +1250,7 @@ namespace OpenSim.Framework.Servers
return true; return true;
} }
} }
}
private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
{ {