From 97c18caa766e2dd72b152b78827ef554f2054f8c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 22 Sep 2009 17:04:34 +0100 Subject: Thank you, Intari, for a patch that implements the missing pieces of Http-in and makes the host name for URL generation configurable. Applied with changes: llGetSimulatorHostname was not changed, because the change breaks existing behavior and carries a data exposure risk. That value needs to be configurable, the proposed fixed change is not acceptable. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 +++++++++----- .../Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 02be983..b631478 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7838,8 +7838,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { m_host.AddScriptLPS(1); - NotImplemented("llGetHTTPHeader"); - return String.Empty; + + if (m_UrlModule != null) + return m_UrlModule.GetHttpHeader(new UUID(request_id), header); + return String.Empty; } @@ -9117,13 +9119,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - public void llHTTPResponse(string url, int status, string body) + public void llHTTPResponse(LSL_Key id, int status, string body) { // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/llHTTPResponse - m_host.AddScriptLPS(1); - NotImplemented("llHTTPResponse"); + m_host.AddScriptLPS(1); + + if (m_UrlModule != null) + m_UrlModule.HttpResponse(new UUID(id), status,body); } public void llResetLandBanList() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 41358e5..a74e8da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -201,7 +201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llGroundRepel(double height, int water, double tau); LSL_Vector llGroundSlope(LSL_Vector offset); LSL_String llHTTPRequest(string url, LSL_List parameters, string body); - void llHTTPResponse(string url, int status, string body); + void llHTTPResponse(LSL_Key id, int status, string body); LSL_String llInsertString(string dst, int position, string src); void llInstantMessage(string user, string message); LSL_String llIntegerToBase64(int number); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 02ae281..a28e97b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -864,9 +864,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llHTTPRequest(url, parameters, body); } - public void llHTTPResponse(string url, int status, string body) + public void llHTTPResponse(LSL_Key id, int status, string body) { - m_LSL_Functions.llHTTPResponse(url, status, body); + m_LSL_Functions.llHTTPResponse(id, status, body); } public LSL_String llInsertString(string dst, int position, string src) -- cgit v1.1 From b7265abfaeb256ebc8421ee1d647dd68f08ff77a Mon Sep 17 00:00:00 2001 From: Alan M Webb Date: Mon, 21 Sep 2009 08:42:01 -0400 Subject: Added delay loop to give a newly created assembly time to appear. On Linux (as an example), it is possible for the existence check to fail because the file is not yet recognized by the file system. Although the loop has a 250mS delay, in practise, the existence test in the for loop is successful and no delay is introduced. Next, this takes care of the two, unpredictable, situations where a script fails to compile. The first is caused by an occasional SEGV in the underlying mono VM while mcs is running, the second is caused by file system latency. Signed-off-by: dr scofield (aka dirk husemann) --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 103 ++++++++++++++------- 1 file changed, 71 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index cb5664b..5a94957 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -542,11 +542,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools break; case enumCompileType.cs: case enumCompileType.lsl: - lock (CScodeProvider) + bool complete = false; + bool retried = false; + do { - results = CScodeProvider.CompileAssemblyFromSource( - parameters, Script); + lock (CScodeProvider) + { + results = CScodeProvider.CompileAssemblyFromSource( + parameters, Script); + } + // Deal with an occasional segv in the compiler. + // Rarely, if ever, occurs twice in succession. + // Line # == 0 and no file name are indications that + // this is a native stack trace rather than a normal + // error log. + if (results.Errors.Count > 0) + { + if (!retried && (results.Errors[0].FileName == null || results.Errors[0].FileName == String.Empty) && + results.Errors[0].Line == 0) + { + // System.Console.WriteLine("retrying failed compilation"); + retried = true; + } + else + { + complete = true; + } + } + else + { + complete = true; + } } + while(!complete); break; case enumCompileType.js: results = JScodeProvider.CompileAssemblyFromSource( @@ -567,17 +595,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // // WARNINGS AND ERRORS // - int display = 5; + bool hadErrors = false; + string errtext = String.Empty; + if (results.Errors.Count > 0) { - string errtext = String.Empty; foreach (CompilerError CompErr in results.Errors) { - // Show 5 errors max - // - if (display <= 0) - break; - display--; string severity = "Error"; if (CompErr.IsWarning) @@ -587,36 +611,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools KeyValuePair lslPos; - lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); + // Show 5 errors max, but check entire list for errors + + if (severity == "Error") + { + lslPos = FindErrorPosition(CompErr.Line, CompErr.Column); + string text = CompErr.ErrorText; + + // Use LSL type names + if (lang == enumCompileType.lsl) + text = ReplaceTypes(CompErr.ErrorText); + + // The Second Life viewer's script editor begins + // countingn lines and columns at 0, so we subtract 1. + errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", + lslPos.Key - 1, lslPos.Value - 1, + CompErr.ErrorNumber, text, severity); + hadErrors = true; + } + } + } - string text = CompErr.ErrorText; + if (hadErrors) + { + throw new Exception(errtext); + } - // Use LSL type names - if (lang == enumCompileType.lsl) - text = ReplaceTypes(CompErr.ErrorText); + // On today's highly asynchronous systems, the result of + // the compile may not be immediately apparent. Wait a + // reasonable amount of time before giving up on it. - // The Second Life viewer's script editor begins - // countingn lines and columns at 0, so we subtract 1. - errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", - lslPos.Key - 1, lslPos.Value - 1, - CompErr.ErrorNumber, text, severity); + if (!File.Exists(OutFile)) + { + for (int i=0; i<20 && !File.Exists(OutFile); i++) + { + System.Threading.Thread.Sleep(250); } - + // One final chance... if (!File.Exists(OutFile)) { + errtext = String.Empty; + errtext += "No compile error. But not able to locate compiled file."; throw new Exception(errtext); } } - // - // NO ERRORS, BUT NO COMPILED FILE - // - if (!File.Exists(OutFile)) - { - string errtext = String.Empty; - errtext += "No compile error. But not able to locate compiled file."; - throw new Exception(errtext); - } // m_log.DebugFormat("[Compiler] Compiled new assembly "+ // "for {0}", asset); @@ -629,7 +668,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (fi == null) { - string errtext = String.Empty; + errtext = String.Empty; errtext += "No compile error. But not able to stat file."; throw new Exception(errtext); } @@ -644,7 +683,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } catch (Exception) { - string errtext = String.Empty; + errtext = String.Empty; errtext += "No compile error. But not able to open file."; throw new Exception(errtext); } -- cgit v1.1 From 9c2ffa8f2e49aa70e0b2c6afff875bbdb84ba0dc Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Wed, 23 Sep 2009 14:55:22 -0400 Subject: * fix endlines in LSL_api.cs --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b631478..4c52b11 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + using System; using System.Collections; using System.Collections.Generic; @@ -7838,8 +7838,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { m_host.AddScriptLPS(1); - - if (m_UrlModule != null) + + if (m_UrlModule != null) return m_UrlModule.GetHttpHeader(new UUID(request_id), header); return String.Empty; } @@ -9124,9 +9124,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/llHTTPResponse - m_host.AddScriptLPS(1); - - if (m_UrlModule != null) + m_host.AddScriptLPS(1); + + if (m_UrlModule != null) m_UrlModule.HttpResponse(new UUID(id), status,body); } -- cgit v1.1