diff options
author | Justin Clark-Casey (justincc) | 2011-08-22 01:58:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-22 01:58:19 +0100 |
commit | 20a4367827d513d9bdafebf6622dc596c2f64879 (patch) | |
tree | 13e8293d36696abad0fc4779edc8d6e905f168cf /OpenSim | |
parent | improve locking of m_llsdHandlers in BaseHttpServer (diff) | |
download | opensim-SC-20a4367827d513d9bdafebf6622dc596c2f64879.zip opensim-SC-20a4367827d513d9bdafebf6622dc596c2f64879.tar.gz opensim-SC-20a4367827d513d9bdafebf6622dc596c2f64879.tar.bz2 opensim-SC-20a4367827d513d9bdafebf6622dc596c2f64879.tar.xz |
remove necessity to catch a KeyNotFoundException in BaseHttpServer.RemoveLLSDHandler()
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 897ee4f..473a01c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1853,21 +1853,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1853 | 1853 | ||
1854 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) | 1854 | public bool RemoveLLSDHandler(string path, LLSDMethod handler) |
1855 | { | 1855 | { |
1856 | try | 1856 | lock (m_llsdHandlers) |
1857 | { | 1857 | { |
1858 | lock (m_llsdHandlers) | 1858 | LLSDMethod foundHandler; |
1859 | |||
1860 | if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler) | ||
1859 | { | 1861 | { |
1860 | if (handler == m_llsdHandlers[path]) | 1862 | m_llsdHandlers.Remove(path); |
1861 | { | 1863 | return true; |
1862 | m_llsdHandlers.Remove(path); | ||
1863 | return true; | ||
1864 | } | ||
1865 | } | 1864 | } |
1866 | } | 1865 | } |
1867 | catch (KeyNotFoundException) | ||
1868 | { | ||
1869 | // This is an exception to prevent crashing because of invalid code | ||
1870 | } | ||
1871 | 1866 | ||
1872 | return false; | 1867 | return false; |
1873 | } | 1868 | } |