From acb0b06fedf8729e98e87f8d2da968f546e5e31f Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Fri, 18 Apr 2008 15:25:43 +0000 Subject: [PATCH] Mantis #851, 100% CPU on unhandlet HTTP event. Thanks cmickeyb. --- .../AsyncCommandPlugins/HttpRequest.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs index 1097ca074a..d62734f7cb 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs @@ -72,18 +72,30 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin // implemented here yet anyway. Should be fixed if/when maxsize // is supported - if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(httpInfo.localID, httpInfo.itemID) != null) + bool handled = false; + iHttpReq.RemoveCompletedRequest(httpInfo.reqID); + foreach (ScriptEngine sman in ScriptEngine.ScriptEngines) { - iHttpReq.RemoveCompletedRequest(httpInfo.reqID); - object[] resobj = new object[] + if (sman.m_ScriptManager.GetScript(httpInfo.localID, httpInfo.itemID) != null) { - httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body - }; + object[] resobj = new object[] + { + httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body + }; - m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( - httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj - ); - //Thread.Sleep(2500); + sman.m_EventQueueManager.AddToScriptQueue( + httpInfo.localID, httpInfo.itemID, "http_response", EventQueueManager.llDetectNull, resobj + ); + + handled = true; + break; + //Thread.Sleep(2500); + } + } + + if (!handled) + { + Console.WriteLine("Unhandled http_response: " + httpInfo.reqID); } httpInfo = iHttpReq.GetNextCompletedRequest();