Lock m_requestMap properly to prevent some nasty access errors and the resulting downward spiral
parent
6bac16fd88
commit
e847d1d83f
|
@ -233,8 +233,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
return;
|
||||
}
|
||||
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
foreach (UUID req in data.requests.Keys)
|
||||
m_RequestMap.Remove(req);
|
||||
}
|
||||
|
||||
RemoveUrl(data);
|
||||
m_UrlMap.Remove(url);
|
||||
|
@ -242,6 +245,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
}
|
||||
|
||||
public void HttpResponse(UUID request, int status, string body)
|
||||
{
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
if (m_RequestMap.ContainsKey(request))
|
||||
{
|
||||
|
@ -260,20 +265,24 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetHttpHeader(UUID requestId, string header)
|
||||
{
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
if (m_RequestMap.ContainsKey(requestId))
|
||||
{
|
||||
UrlData urlData=m_RequestMap[requestId];
|
||||
UrlData urlData = m_RequestMap[requestId];
|
||||
string value;
|
||||
if (urlData.requests[requestId].headers.TryGetValue(header,out value))
|
||||
if (urlData.requests[requestId].headers.TryGetValue(header, out value))
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId);
|
||||
}
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
@ -294,10 +303,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
{
|
||||
RemoveUrl(url.Value);
|
||||
removeURLs.Add(url.Key);
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
foreach (UUID req in url.Value.requests.Keys)
|
||||
m_RequestMap.Remove(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string urlname in removeURLs)
|
||||
m_UrlMap.Remove(urlname);
|
||||
|
@ -316,10 +328,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
{
|
||||
RemoveUrl(url.Value);
|
||||
removeURLs.Add(url.Key);
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
foreach (UUID req in url.Value.requests.Keys)
|
||||
m_RequestMap.Remove(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string urlname in removeURLs)
|
||||
m_UrlMap.Remove(urlname);
|
||||
|
@ -355,8 +370,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
lock (url)
|
||||
{
|
||||
url.requests.Remove(requestID);
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
m_RequestMap.Remove(requestID);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -431,8 +449,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
|||
lock (url)
|
||||
{
|
||||
url.requests.Remove(requestID);
|
||||
lock (m_RequestMap)
|
||||
{
|
||||
m_RequestMap.Remove(requestID);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue