diff options
author | Justin Clark-Casey (justincc) | 2011-08-22 02:07:51 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-22 02:07:51 +0100 |
commit | 9469c62098b00d2322ac66d61d03689792d03de7 (patch) | |
tree | 29ca8ad1dafb3447b30eadeedcea8009c402bd6b | |
parent | improve locking of m_HTTPHandlers in BaseHttpServer (diff) | |
download | opensim-SC-9469c62098b00d2322ac66d61d03689792d03de7.zip opensim-SC-9469c62098b00d2322ac66d61d03689792d03de7.tar.gz opensim-SC-9469c62098b00d2322ac66d61d03689792d03de7.tar.bz2 opensim-SC-9469c62098b00d2322ac66d61d03689792d03de7.tar.xz |
improve locking of m_agentHandlers in BaseHttpServer
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 22417b6..fd0621b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -66,7 +66,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
66 | protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); | 66 | protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); |
67 | protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); | 67 | protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); |
68 | protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); | 68 | protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); |
69 | |||
70 | protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = | 69 | protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = |
71 | new Dictionary<string, PollServiceEventArgs>(); | 70 | new Dictionary<string, PollServiceEventArgs>(); |
72 | 71 | ||
@@ -247,7 +246,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
247 | return new List<string>(m_pollHandlers.Keys); | 246 | return new List<string>(m_pollHandlers.Keys); |
248 | } | 247 | } |
249 | 248 | ||
250 | |||
251 | // Note that the agent string is provided simply to differentiate | 249 | // Note that the agent string is provided simply to differentiate |
252 | // the handlers - it is NOT required to be an actual agent header | 250 | // the handlers - it is NOT required to be an actual agent header |
253 | // value. | 251 | // value. |
@@ -268,7 +266,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
268 | 266 | ||
269 | public List<string> GetAgentHandlerKeys() | 267 | public List<string> GetAgentHandlerKeys() |
270 | { | 268 | { |
271 | return new List<string>(m_agentHandlers.Keys); | 269 | lock (m_agentHandlers) |
270 | return new List<string>(m_agentHandlers.Keys); | ||
272 | } | 271 | } |
273 | 272 | ||
274 | public bool AddLLSDHandler(string path, LLSDMethod handler) | 273 | public bool AddLLSDHandler(string path, LLSDMethod handler) |
@@ -749,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
749 | private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) | 748 | private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) |
750 | { | 749 | { |
751 | agentHandler = null; | 750 | agentHandler = null; |
752 | try | 751 | |
752 | lock (m_agentHandlers) | ||
753 | { | 753 | { |
754 | foreach (IHttpAgentHandler handler in m_agentHandlers.Values) | 754 | foreach (IHttpAgentHandler handler in m_agentHandlers.Values) |
755 | { | 755 | { |
@@ -760,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
760 | } | 760 | } |
761 | } | 761 | } |
762 | } | 762 | } |
763 | catch(KeyNotFoundException) | ||
764 | { | ||
765 | } | ||
766 | 763 | ||
767 | return false; | 764 | return false; |
768 | } | 765 | } |
@@ -1829,10 +1826,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1829 | { | 1826 | { |
1830 | try | 1827 | try |
1831 | { | 1828 | { |
1832 | if (handler == m_agentHandlers[agent]) | 1829 | lock (m_agentHandlers) |
1833 | { | 1830 | { |
1834 | m_agentHandlers.Remove(agent); | 1831 | if (handler == m_agentHandlers[agent]) |
1835 | return true; | 1832 | { |
1833 | m_agentHandlers.Remove(agent); | ||
1834 | return true; | ||
1835 | } | ||
1836 | } | 1836 | } |
1837 | } | 1837 | } |
1838 | catch(KeyNotFoundException) | 1838 | catch(KeyNotFoundException) |