From 442b27222828381a27c7c5eddc967a0de4c82d0a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Jul 2016 13:20:56 +0100 Subject: add a Drop method to PollService Event handlers, Drop requests on connections known to be lost or delay event check if they are sending a response --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 6 ++++- .../ClientStack/Linden/Caps/GetMeshModule.cs | 11 ++++++++- .../ClientStack/Linden/Caps/GetTextureModule.cs | 6 +++-- .../Linden/Caps/WebFetchInvDescModule.cs | 4 +++- .../CoreModules/Scripting/LSLHttp/UrlModule.cs | 26 ++++++++++++++++++++-- 5 files changed, 46 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index cc614f3..18670f5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterPollHandler( "EventQueueGet", - new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS)); + new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS)); } public bool HasEvents(UUID requestID, UUID agentID) @@ -403,6 +403,10 @@ namespace OpenSim.Region.ClientStack.Linden ev["message"], m_scene.GetScenePresence(agentId).Name, m_scene.Name); } } + public void Drop(UUID requestID, UUID pAgentId) + { + // do nothing for now, hope client close will do it + } public Hashtable GetEvents(UUID requestID, UUID pAgentId) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index f66ef57..7831de3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -226,7 +226,7 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; private MeshCapsDataThrottler m_throttler; public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : - base(null, uri, null, null, null, pId, int.MaxValue) + base(null, uri, null, null, null, null, pId, int.MaxValue) { m_scene = scene; m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); @@ -241,6 +241,15 @@ namespace OpenSim.Region.ClientStack.Linden } }; + + Drop= (x, y) => + { + lock (responses) + { + responses.Remove(x); + } + }; + GetEvents = (x, y) => { lock (responses) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 14a59fe..ee7e291 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; private CapsDataThrottler m_throttler = new CapsDataThrottler(100000, 1400000,10000); public PollServiceTextureEventArgs(UUID pId, Scene scene) : - base(null, "", null, null, null, pId, int.MaxValue) + base(null, "", null, null, null, null, pId, int.MaxValue) { m_scene = scene; // x is request id, y is userid @@ -236,6 +236,9 @@ namespace OpenSim.Region.ClientStack.Linden } }; + + Drop = (x, y) => { lock (responses) responses.Remove(x); }; + GetEvents = (x, y) => { lock (responses) @@ -423,7 +426,6 @@ namespace OpenSim.Region.ClientStack.Linden internal sealed class CapsDataThrottler { - private volatile int currenttime = 0; private volatile int lastTimeElapsed = 0; private volatile int BytesSent = 0; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index ba4fb76..bde94e6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -256,11 +256,13 @@ namespace OpenSim.Region.ClientStack.Linden private WebFetchInvDescModule m_module; public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : - base(null, url, null, null, null, pId, int.MaxValue) + base(null, url, null, null, null, null, pId, int.MaxValue) { m_module = module; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; + Drop = (x, y) => { lock (responses) responses.Remove(x); }; + GetEvents = (x, y) => { lock (responses) diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index f563c68..c118f33 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp string uri = "/lslhttp/" + urlcode.ToString() + "/"; PollServiceEventArgs args - = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); + = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); args.Type = PollServiceEventArgs.EventType.LslHttp; m_HttpServer.AddPollServiceHTTPHandler(uri, args); @@ -276,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp string uri = "/lslhttps/" + urlcode.ToString() + "/"; PollServiceEventArgs args - = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, urlcode, 25000); + = new PollServiceEventArgs(HttpRequestHandler, uri, HasEvents, GetEvents, NoEvents, Drop, urlcode, 25000); args.Type = PollServiceEventArgs.EventType.LslHttp; m_HttpsServer.AddPollServiceHTTPHandler(uri, args); @@ -530,6 +530,28 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } } } + + private void Drop(UUID requestID, UUID sessionID) + { + UrlData url = null; + lock (m_RequestMap) + { + if (m_RequestMap.ContainsKey(requestID)) + { + url = m_RequestMap[requestID]; + m_RequestMap.Remove(requestID); + if(url != null) + { + lock (url.requests) + { + if(url.requests.ContainsKey(requestID)) + url.requests.Remove(requestID); + } + } + } + } + } + private Hashtable GetEvents(UUID requestID, UUID sessionID) { UrlData url = null; -- cgit v1.1