improve locking of m_agentHandlers in BaseHttpServer
parent
f9a367e2f6
commit
9469c62098
|
@ -66,7 +66,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||||
|
|
||||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||||
new Dictionary<string, PollServiceEventArgs>();
|
new Dictionary<string, PollServiceEventArgs>();
|
||||||
|
|
||||||
|
@ -247,7 +246,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return new List<string>(m_pollHandlers.Keys);
|
return new List<string>(m_pollHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Note that the agent string is provided simply to differentiate
|
// Note that the agent string is provided simply to differentiate
|
||||||
// the handlers - it is NOT required to be an actual agent header
|
// the handlers - it is NOT required to be an actual agent header
|
||||||
// value.
|
// value.
|
||||||
|
@ -268,6 +266,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
public List<string> GetAgentHandlerKeys()
|
public List<string> GetAgentHandlerKeys()
|
||||||
{
|
{
|
||||||
|
lock (m_agentHandlers)
|
||||||
return new List<string>(m_agentHandlers.Keys);
|
return new List<string>(m_agentHandlers.Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||||
{
|
{
|
||||||
agentHandler = null;
|
agentHandler = null;
|
||||||
try
|
|
||||||
|
lock (m_agentHandlers)
|
||||||
{
|
{
|
||||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||||
{
|
{
|
||||||
|
@ -760,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(KeyNotFoundException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1828,6 +1825,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
lock (m_agentHandlers)
|
||||||
{
|
{
|
||||||
if (handler == m_agentHandlers[agent])
|
if (handler == m_agentHandlers[agent])
|
||||||
{
|
{
|
||||||
|
@ -1835,6 +1834,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(KeyNotFoundException)
|
catch(KeyNotFoundException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue