we can speedup some not simple StreamHandler a bit

master
UbitUmarov 2020-04-24 18:14:41 +01:00
parent 07caee4956
commit bac6890391
1 changed files with 4 additions and 2 deletions

View File

@ -981,14 +981,16 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetStreamHandler(string handlerKey, out IRequestHandler streamHandler)
{
if(m_streamHandlers.TryGetValue(handlerKey, out streamHandler))
return true;
string bestMatch = null;
lock (m_streamHandlers)
{
foreach (string pattern in m_streamHandlers.Keys)
{
if ((handlerKey == pattern)
|| (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0)))
if (handlerKey.StartsWith(pattern) && (HANDLER_SEPARATORS.IndexOf(handlerKey[pattern.Length]) >= 0))
{
if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
{