private void ReQueueEvent(PollServiceHttpRequest req) { if (IsRunning) { // delay the enqueueing for 100ms. There's no need to have the event // actively on the queue Timer t = new Timer(self => { ((Timer)self).Dispose(); m_requests.Enqueue(req); }); t.Change(100, Timeout.Infinite); } }
public bool Enqueue(OSD ev, UUID avatarID) { //m_log.DebugFormat("[EVENTQUEUE]: Enqueuing event for {0} in region {1}", avatarID, m_scene.RegionInfo.RegionName); try { ThreadedClasses.BlockingQueue <OSD> queue = GetQueue(avatarID); if (queue != null) { queue.Enqueue(ev); } else if (DebugLevel > 0) { ScenePresence sp = m_scene.GetScenePresence(avatarID); // This assumes that an NPC should never have a queue. if (sp != null && sp.PresenceType != PresenceType.Npc) { OSDMap evMap = (OSDMap)ev; m_log.WarnFormat( "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} {1} when placing message {2} in region {3}", sp.Name, sp.UUID, evMap["message"], m_scene.Name); } } } catch (NullReferenceException e) { m_log.Error("[EVENTQUEUE] Caught exception: " + e); return(false); } return(true); }
private Hashtable HandleHttpSessionCommand(Hashtable request) { DoExpire(); Hashtable post = DecodePostString(request["body"].ToString()); Hashtable reply = new Hashtable(); reply["str_response_string"] = ""; reply["int_response_code"] = 404; reply["content_type"] = "text/plain"; if (post["ID"] == null) { return(reply); } UUID id; if (!UUID.TryParse(post["ID"].ToString(), out id)) { return(reply); } if (!m_Connections.ContainsKey(id)) { return(reply); } if (post["COMMAND"] == null) { return(reply); } m_InputData.Enqueue(post["COMMAND"].ToString()); XmlDocument xmldoc = new XmlDocument(); XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", ""); xmldoc.AppendChild(xmlnode); XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession", ""); xmldoc.AppendChild(rootElement); XmlElement res = xmldoc.CreateElement("", "Result", ""); res.AppendChild(xmldoc.CreateTextNode("OK")); rootElement.AppendChild(res); reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; reply = CheckOrigin(reply); return(reply); }
public override void Output(string text, string level) { m_consoleQueue.Enqueue(new KeyValuePair <string, string>(text, level)); }