public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : base(null, url, null, null, null, pId, int.MaxValue) { m_module = module; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y) => { lock (responses) { try { return responses[x]; } finally { responses.Remove(x); } } }; Request = (x, y) => { ScenePresence sp = m_module.Scene.GetScenePresence(Id); aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; reqinfo.presence = sp; reqinfo.folders = new List<UUID>(); // Decode the request here string request = y["body"].ToString(); request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); Hashtable hash = new Hashtable(); try { hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); } catch (LLSD.LLSDParseException e) { m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace); m_log.Error("Request: " + request); return; } catch (System.Xml.XmlException) { m_log.ErrorFormat("[INVENTORY]: XML Format error"); } ArrayList foldersrequested = (ArrayList)hash["folders"]; bool highPriority = false; for (int i = 0; i < foldersrequested.Count; i++) { Hashtable inventoryhash = (Hashtable)foldersrequested[i]; string folder = inventoryhash["folder_id"].ToString(); UUID folderID; if (UUID.TryParse(folder, out folderID)) { if (!reqinfo.folders.Contains(folderID)) { //TODO: Port COF handling from Avination reqinfo.folders.Add(folderID); } } } if (highPriority) m_queue.EnqueueHigh(reqinfo); else m_queue.EnqueueLow(reqinfo); }; NoEvents = (x, y) => { /* lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); } */ Hashtable 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; return response; }; }
public void Process(aPollRequest requestinfo) { UUID requestID = requestinfo.reqID; Hashtable response = new Hashtable(); response["int_response_code"] = 200; response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); lock (responses) { 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; } WebFetchInvDescModule.ProcessedRequestsCount++; }
public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : base(null, uri, null, null, null, pId, int.MaxValue) { m_scene = scene; m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); // x is request id, y is userid HasEvents = (x, y) => { lock (responses) { bool ret = m_throttler.hasEvents(x, responses); m_throttler.ProcessTime(); return ret; } }; GetEvents = (x, y) => { lock (responses) { try { return responses[x].response; } finally { m_throttler.ProcessTime(); responses.Remove(x); } } }; // x is request id, y is request data hashtable Request = (x, y) => { aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; m_queue.Enqueue(reqinfo); }; // this should never happen except possible on shutdown NoEvents = (x, y) => { /* lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); } */ Hashtable 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; return response; }; }
public void Process(aPollRequest requestinfo) { Hashtable response; UUID requestID = requestinfo.reqID; // 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, lod = 0 }; return; } response = m_getMeshHandler.Handle(requestinfo.request); lock (responses) { responses[requestID] = new aPollResponse() { bytes = (int)response["int_bytes"], lod = (int)response["int_lod"], response = response }; } m_throttler.ProcessTime(); }
public void Process(aPollRequest requestinfo) { Hashtable response; UUID requestID = requestinfo.reqID; 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 }; } m_throttler.ProcessTime(); }
public void Process(aPollRequest requestinfo) { UUID requestID = requestinfo.reqID; Hashtable response = new Hashtable(); response["int_response_code"] = 200; response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); lock (responses) responses[requestID] = response; }
public PollServiceTextureEventArgs(UUID pId, Scene scene) : base(null, "", null, null, null, pId, int.MaxValue) { m_scene = scene; // x is request id, y is userid HasEvents = (x, y) => { lock (responses) { bool ret = m_throttler.hasEvents(x, responses); m_throttler.ProcessTime(); return ret; } }; GetEvents = (x, y) => { lock (responses) { try { return responses[x].response; } finally { responses.Remove(x); } } }; // x is request id, y is request data hashtable Request = (x, y) => { aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; reqinfo.send503 = false; lock (responses) { if (responses.Count > 0) { if (m_queue.Count >= 4) { // Never allow more than 4 fetches to wait reqinfo.send503 = true; } } } m_queue.Enqueue(reqinfo); }; // this should never happen except possible on shutdown NoEvents = (x, y) => { /* lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); } */ Hashtable 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; return response; }; }
public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : base(null, url, null, null, null, pId, int.MaxValue) { m_module = module; HasEvents = (x, y) => { return(responses.ContainsKey(x)); }; GetEvents = (x, y) => { Hashtable val; responses.Remove(x, out val); return(val); }; Request = (x, y) => { ScenePresence sp = m_module.Scene.GetScenePresence(Id); if (sp == null) { m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); return; } aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; reqinfo.presence = sp; reqinfo.folders = new List <UUID>(); // Decode the request here string request = y["body"].ToString(); request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); Hashtable hash = new Hashtable(); try { hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); } catch (LLSD.LLSDParseException e) { m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace); m_log.Error("Request: " + request); return; } catch (System.Xml.XmlException) { m_log.ErrorFormat("[INVENTORY]: XML Format error"); } ArrayList foldersrequested = (ArrayList)hash["folders"]; for (int i = 0; i < foldersrequested.Count; i++) { Hashtable inventoryhash = (Hashtable)foldersrequested[i]; string folder = inventoryhash["folder_id"].ToString(); UUID folderID; if (UUID.TryParse(folder, out folderID)) { if (!reqinfo.folders.Contains(folderID)) { //TODO: Port COF handling from Avination reqinfo.folders.Add(folderID); } } } m_queue.Enqueue(reqinfo); }; NoEvents = (x, y) => { /* * lock (requests) * { * Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); * requests.Remove(request); * } */ Hashtable 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; return(response); }; }
public PollServiceMeshEventArgs(string uri, UUID pId, Scene scene) : base(null, uri, null, null, null, pId, int.MaxValue) { m_scene = scene; m_throttler = new MeshCapsDataThrottler(100000, 1400000, 10000, scene, pId); // x is request id, y is userid HasEvents = (x, y) => { lock (responses) { bool ret = m_throttler.hasEvents(x, responses); m_throttler.ProcessTime(); return(ret); } }; GetEvents = (x, y) => { lock (responses) { try { return(responses[x].response); } finally { m_throttler.ProcessTime(); responses.Remove(x); } } }; // x is request id, y is request data hashtable Request = (x, y) => { aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; m_queue.Enqueue(reqinfo); }; // this should never happen except possible on shutdown NoEvents = (x, y) => { /* * lock (requests) * { * Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); * requests.Remove(request); * } */ Hashtable 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; return(response); }; }
public void Process(aPollRequest requestinfo) { Hashtable response; UUID requestID = requestinfo.reqID; if (m_scene.ShuttingDown) { return; } lock (responses) { 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; responses[requestID] = new aPollResponse() { bytes = 0, response = response }; 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"], response = response }; } m_throttler.PassTime(); }
public PollServiceTextureEventArgs(UUID pId, Scene scene) : base(null, "", null, null, null, null, pId, int.MaxValue) { m_scene = scene; m_throttler = new CapsDataThrottler(100000); // x is request id, y is userid HasEvents = (x, y) => { lock (responses) { bool ret = m_throttler.hasEvents(x, responses); return(ret); } }; Drop = (x, y) => { lock (responses) { responses.Remove(x); dropedResponses.Add(x); } }; GetEvents = (x, y) => { lock (responses) { try { return(responses[x].response); } finally { responses.Remove(x); m_throttler.PassTime(); } } }; // x is request id, y is request data hashtable Request = (x, y) => { aPollRequest reqinfo = new aPollRequest(); reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; reqinfo.send503 = false; lock (responses) { if (responses.Count > 0) { if (m_queue.Count() >= 4) { // Never allow more than 4 fetches to wait reqinfo.send503 = true; } } } m_queue.Enqueue(reqinfo); m_throttler.PassTime(); }; // this should never happen except possible on shutdown NoEvents = (x, y) => { /* * lock (requests) * { * Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); * requests.Remove(request); * } */ Hashtable 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; return(response); }; }