diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 7831de397d..783c3de6e1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -222,6 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden new List(); private Dictionary responses = new Dictionary(); + private HashSet dropedResponses = new HashSet(); private Scene m_scene; private MeshCapsDataThrottler m_throttler; @@ -242,11 +243,13 @@ namespace OpenSim.Region.ClientStack.Linden } }; - Drop= (x, y) => + Drop = (x, y) => { lock (responses) { responses.Remove(x); + lock(dropedResponses) + dropedResponses.Add(x); } }; @@ -307,26 +310,47 @@ namespace OpenSim.Region.ClientStack.Linden if(m_scene.ShuttingDown) return; - // If the avatar is gone, don't bother to get the texture - if (m_scene.GetScenePresence(Id) == null) + lock(responses) { - response = new Hashtable(); + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + return; + } + } + + // If the avatar is gone, don't bother to get the texture + if (m_scene.GetScenePresence(Id) == null) + { + response = new Hashtable(); - response["int_response_code"] = 500; - response["str_response_string"] = "Script timeout"; - response["content_type"] = "text/plain"; - response["keepalive"] = false; - response["reusecontext"] = false; + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; - lock (responses) responses[requestID] = new aPollResponse() { bytes = 0, response = response, lod = 0 }; - return; + return; + } } response = m_getMeshHandler.Handle(requestinfo.request); + lock (responses) { + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + return; + } + } + responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index ee7e291f70..15c096735e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -218,6 +218,7 @@ namespace OpenSim.Region.ClientStack.Linden new List(); private Dictionary responses = new Dictionary(); + private HashSet dropedResponses = new HashSet(); private Scene m_scene; private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); @@ -237,7 +238,14 @@ namespace OpenSim.Region.ClientStack.Linden } }; - Drop = (x, y) => { lock (responses) responses.Remove(x); }; + Drop = (x, y) => + { + lock (responses) + { + responses.Remove(x); + dropedResponses.Add(x); + } + }; GetEvents = (x, y) => { @@ -307,52 +315,71 @@ namespace OpenSim.Region.ClientStack.Linden if(m_scene.ShuttingDown) return; - if (requestinfo.send503) - { - response = new Hashtable(); - - response["int_response_code"] = 503; - response["str_response_string"] = "Throttled"; - response["content_type"] = "text/plain"; - response["keepalive"] = false; - response["reusecontext"] = false; - - Hashtable headers = new Hashtable(); - headers["Retry-After"] = 30; - response["headers"] = headers; - - lock (responses) - responses[requestID] = new aPollResponse() {bytes = 0, response = response}; - - return; - } - - // If the avatar is gone, don't bother to get the texture - if (m_scene.GetScenePresence(Id) == null) - { - response = new Hashtable(); - - response["int_response_code"] = 500; - response["str_response_string"] = "Script timeout"; - response["content_type"] = "text/plain"; - response["keepalive"] = false; - response["reusecontext"] = false; - - lock (responses) - responses[requestID] = new aPollResponse() {bytes = 0, response = response}; - - return; - } - - response = m_getTextureHandler.Handle(requestinfo.request); lock (responses) { - responses[requestID] = new aPollResponse() - { - bytes = (int) response["int_bytes"], - response = response - }; + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + return; + } + } + + if (requestinfo.send503) + { + response = new Hashtable(); + + response["int_response_code"] = 503; + response["str_response_string"] = "Throttled"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + Hashtable headers = new Hashtable(); + headers["Retry-After"] = 30; + response["headers"] = headers; + responses[requestID] = new aPollResponse() {bytes = 0, response = response}; + + return; + } + + // If the avatar is gone, don't bother to get the texture + if (m_scene.GetScenePresence(Id) == null) + { + response = new Hashtable(); + + response["int_response_code"] = 500; + response["str_response_string"] = "Script timeout"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + responses[requestID] = new aPollResponse() {bytes = 0, response = response}; + + return; + } + } + + response = m_getTextureHandler.Handle(requestinfo.request); + + lock (responses) + { + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + m_throttler.ProcessTime(); + return; + } + } + responses[requestID] = new aPollResponse() + { + bytes = (int) response["int_bytes"], + response = response + }; } m_throttler.ProcessTime(); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index bde94e624d..ed5b3ddd1f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -250,8 +250,8 @@ namespace OpenSim.Region.ClientStack.Linden { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary responses = - new Dictionary(); + private Dictionary responses = new Dictionary(); + private HashSet dropedResponses = new HashSet(); private WebFetchInvDescModule m_module; @@ -261,7 +261,16 @@ namespace OpenSim.Region.ClientStack.Linden m_module = module; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; - Drop = (x, y) => { lock (responses) responses.Remove(x); }; + + Drop = (x, y) => + { + lock (responses) + { + responses.Remove(x); + lock(dropedResponses) + dropedResponses.Add(x); + } + }; GetEvents = (x, y) => { @@ -367,6 +376,19 @@ namespace OpenSim.Region.ClientStack.Linden UUID requestID = requestinfo.reqID; + + lock(responses) + { + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + return; + } + } + } + Hashtable response = new Hashtable(); response["int_response_code"] = 200; @@ -379,6 +401,18 @@ namespace OpenSim.Region.ClientStack.Linden lock (responses) { + lock(dropedResponses) + { + if(dropedResponses.Contains(requestID)) + { + dropedResponses.Remove(requestID); + requestinfo.folders.Clear(); + requestinfo.request.Clear(); + WebFetchInvDescModule.ProcessedRequestsCount++; + return; + } + } + if (responses.ContainsKey(requestID)) m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054"); responses[requestID] = response;