From 824eb7ed20a006a7abf0b1cd4d7f46d9c154647e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 10 Mar 2012 19:51:28 -0800 Subject: Added osGetGridGatekeeperURI() --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++++++++++++++ .../Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 3 files changed, 20 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8edd146..3dbc31a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2093,6 +2093,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return HomeURI; } + public string osGetGridGatekeeperURI() + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); + m_host.AddScriptLPS(1); + + string gatekeeperURI = String.Empty; + IConfigSource config = m_ScriptEngine.ConfigSource; + + if (config.Configs["GridService"] != null) + gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI); + + return gatekeeperURI; + } + public string osGetGridCustom(string key) { CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 82a6caf..a5b906f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -161,6 +161,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetGridName(); string osGetGridLoginURI(); string osGetGridHomeURI(); + string osGetGridGatekeeperURI(); string osGetGridCustom(string key); LSL_String osFormatString(string str, LSL_List strings); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4341246..e048da2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -457,6 +457,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetGridHomeURI(); } + public string osGetGridGatekeeperURI() + { + return m_OSSL_Functions.osGetGridGatekeeperURI(); + } + public string osGetGridCustom(string key) { return m_OSSL_Functions.osGetGridCustom(key); -- cgit v1.1 From 13fb582c124e173202f9cd157f8f107b67acec4b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 12 Mar 2012 07:55:17 -0700 Subject: DataSnapshot: renamed gridserverURL to gatekeeperURL, and normalimzed the capitalization of 'name' to lower case, also in the same section. --- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 9fc002b..209fb52 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -103,10 +103,10 @@ namespace OpenSim.Region.DataSnapshot m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); IConfig conf = config.Configs["GridService"]; if (conf != null) - m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003")); + m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty)); m_gridinfo.Add( - "Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo")); + "name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo")); m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level); m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); -- cgit v1.1 From e0dd38f6722e891cfc91c8d795604b7b78c0bc81 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 12 Mar 2012 10:07:04 -0700 Subject: Rename the stream extension method WebUtil.CopyTo() to WebUtil.CopyStream(). .NET 4.0 added the method Stream.CopyTo(stream, bufferSize). For .NET 3.5 and before, WebUtil defined an extension method for Stream with the signature Stream.CopyTo(stream, maxBytesToCopy). The meaning of the second parameter is different in the two forms and depending on which compiler and/or runtime you use, you could get one form or the other. Crashes ensue. This change renames the WebUtil stream copy method to something that cannot be confused with the new CopyTo method defined in .NET 4.0. --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 2 +- OpenSim/Framework/MultipartForm.cs | 2 +- OpenSim/Framework/WebUtil.cs | 7 ++++++- .../Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 95ef72a..06fe55a 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -162,7 +162,7 @@ namespace OpenSim.Data.MySQL using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) { MemoryStream outputStream = new MemoryStream(); - WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); + WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); // int compressedLength = asset.Data.Length; asset.Data = outputStream.ToArray(); diff --git a/OpenSim/Framework/MultipartForm.cs b/OpenSim/Framework/MultipartForm.cs index 90c4007..7a13e8b 100644 --- a/OpenSim/Framework/MultipartForm.cs +++ b/OpenSim/Framework/MultipartForm.cs @@ -119,7 +119,7 @@ namespace OpenSim.Framework // Copy the temporary stream to the network stream formDataStream.Seek(0, SeekOrigin.Begin); using (Stream requestStream = request.GetRequestStream()) - formDataStream.CopyTo(requestStream, (int)formDataStream.Length); + formDataStream.CopyStream(requestStream, (int)formDataStream.Length); } #endregion Stream Writing diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 77f3d9b..ead8f46 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -510,8 +510,13 @@ namespace OpenSim.Framework /// /// Copying begins at the streams' current positions. The positions are /// NOT reset after copying is complete. + /// NOTE!! .NET 4.0 adds the method 'Stream.CopyTo(stream, bufferSize)'. + /// This function could be replaced with that method once we move + /// totally to .NET 4.0. For versions before, this routine exists. + /// This routine used to be named 'CopyTo' but the int parameter has + /// a different meaning so this method was renamed to avoid any confusion. /// - public static int CopyTo(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) + public static int CopyStream(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) { byte[] buffer = new byte[4096]; int readBytes; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 99523a1..6bfc5cc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -477,7 +477,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // Grab the asset data from the response stream using (MemoryStream stream = new MemoryStream()) { - responseStream.CopyTo(stream, 4096); + responseStream.CopyStream(stream, Int32.MaxValue); asset.Data = stream.ToArray(); } } -- cgit v1.1 From 25592bbd852e9350bca25f240d6d54c7a54e28a0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 Mar 2012 21:16:05 +0000 Subject: Add max thread and min thread information to "xengine status" region console command --- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 3 +++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 2 ++ 2 files changed, 5 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index bc1902b..4010167 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -578,7 +578,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance return true; if (!m_InSelfDelete) + { +// m_log.ErrorFormat("[SCRIPT INSTANCE]: Aborting script {0} {1}", ScriptName, ItemID); result.Abort(); + } lock (m_EventQueue) { diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b433430..66349e3 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -384,6 +384,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); + sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); + sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads); sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); -- cgit v1.1 From 4eb2605c790857a86178bf3d170ea5a1a88f696e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 13 Mar 2012 08:06:30 -0700 Subject: Datasnapshot: added "secret" to the registration/deregistration query so that data providers can verify authenticity if they want. --- OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 52 +++++++++------------- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 9 +++- 2 files changed, 28 insertions(+), 33 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 93648d6..2f2b3e6 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs @@ -46,8 +46,6 @@ namespace OpenSim.Region.DataSnapshot private DataSnapshotManager m_externalData = null; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly string m_discoveryPath = "DS0001/"; - public DataRequestHandler(Scene scene, DataSnapshotManager externalData) { m_scene = scene; @@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot { m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); } + // Register validation callback handler + MainServer.Instance.AddHTTPHandler("validate", OnValidate); - //Register CAPS handler event - m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; - - //harbl - } - - public void OnRegisterCaps(UUID agentID, Caps caps) - { -// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID); - string capsBase = "/CAPS/" + caps.CapsObjectPath; - caps.RegisterHandler("PublicSnapshotDataInfo", - new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt)); - } - - public string OnDiscoveryAttempt(string request, string path, string param, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - //Very static for now, flexible enough to add new formats - LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse(); - llsd_response.snapshot_resources = new OSDArray(); - - LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL(); - llsd_dataurl.snapshot_format = "os-datasnapshot-v1"; - llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector"; - - llsd_response.snapshot_resources.Array.Add(llsd_dataurl); - - string response = LLSDHelpers.SerialiseLLSDReply(llsd_response); - - return response; } public Hashtable OnGetSnapshot(Hashtable keysvals) @@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot return reply; } + + public Hashtable OnValidate(Hashtable keysvals) + { + m_log.Info("[DATASNAPSHOT] Received validation request"); + Hashtable reply = new Hashtable(); + int statuscode = 200; + + string secret = (string)keysvals["secret"]; + if (secret == m_externalData.Secret.ToString()) + statuscode = 403; + + reply["str_response_string"] = string.Empty; + reply["int_response_code"] = statuscode; + reply["content_type"] = "text/plain"; + + return reply; + } + } } diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 209fb52..5540656 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot private string m_dataServices = "noservices"; public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); public string m_hostname = "127.0.0.1"; + private UUID m_Secret = UUID.Random(); //Update timers private int m_period = 20; // in seconds @@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot get { return m_exposure_level; } } + public UUID Secret + { + get { return m_Secret; } + } + #endregion #region IRegionModule @@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot cli.AddQueryParameter("service", serviceName); cli.AddQueryParameter("host", m_hostname); cli.AddQueryParameter("port", m_listener_port); + cli.AddQueryParameter("secret", m_Secret.ToString()); cli.RequestMethod = "GET"; try { @@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot } // This is not quite working, so... // string responseStr = Util.UTF8.GetString(response); - m_log.Info("[DATASNAPSHOT]: data service notified: " + url); + m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret); } } -- cgit v1.1 From 95ec96bf86ebebbc6c2f2c3f3a2bd8ce3f9990f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 14 Mar 2012 00:29:36 +0000 Subject: refactor: rename ScriptInstance.m_CurrentResult to m_CurrentWorkItem to make it more understandable as to what it is and what it does (hold a thread pool work item for a waiting of in-progress event) Also add other various illustrative comments --- .../ScriptEngine/Interfaces/IScriptInstance.cs | 8 ++- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 66 ++++++++++++++-------- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 1 - 3 files changed, 50 insertions(+), 25 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index d3200d5..f00e41f 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces void Start(); /// - /// Stop the script. + /// Stop the script instance. /// /// /// true if the script was successfully stopped, false otherwise @@ -97,13 +97,17 @@ namespace OpenSim.Region.ScriptEngine.Interfaces void SetState(string state); + /// + /// Post an event to this script instance. + /// + /// void PostEvent(EventParams data); void Suspend(); void Resume(); /// - /// Process the next event queued for this script + /// Process the next event queued for this script instance. /// /// object EventProcessor(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 4010167..b840730 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -58,7 +58,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IScriptEngine m_Engine; - private IScriptWorkItem m_CurrentResult = null; + + /// + /// The current work item if an event for this script is running or waiting to run, + /// + /// + /// Null if there is no running or waiting to run event. Must be changed only under an m_EventQueue lock. + /// + private IScriptWorkItem m_CurrentWorkItem; + private Queue m_EventQueue = new Queue(32); private bool m_RunEvents = false; private UUID m_ItemID; @@ -157,7 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { // Need to place ourselves back in a work item if there are events to process if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) - m_CurrentResult = m_Engine.QueueEventHandler(this); + m_CurrentWorkItem = m_Engine.QueueEventHandler(this); } } } @@ -527,8 +535,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (m_EventQueue.Count > 0) { - if (m_CurrentResult == null) - m_CurrentResult = m_Engine.QueueEventHandler(this); + if (m_CurrentWorkItem == null) + m_CurrentWorkItem = m_Engine.QueueEventHandler(this); // else // m_log.Error("[Script] Tried to start a script that was already queued"); } @@ -540,52 +548,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance // m_log.DebugFormat( // "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout); - IScriptWorkItem result; + IScriptWorkItem workItem; lock (m_EventQueue) { if (!Running) return true; - if (m_CurrentResult == null) + // If we're not running or waiting to run an event then we can safely stop. + if (m_CurrentWorkItem == null) { m_RunEvents = false; return true; } - if (m_CurrentResult.Cancel()) + // If we are waiting to run an event then we can try to cancel it. + if (m_CurrentWorkItem.Cancel()) { - m_CurrentResult = null; + m_CurrentWorkItem = null; m_RunEvents = false; return true; } - result = m_CurrentResult; + workItem = m_CurrentWorkItem; m_RunEvents = false; } - if (result.Wait(new TimeSpan((long)timeout * 100000))) + // Wait for the current event to complete. + if (workItem.Wait(new TimeSpan((long)timeout * 100000))) { return true; } lock (m_EventQueue) { - result = m_CurrentResult; + workItem = m_CurrentWorkItem; } - if (result == null) + if (workItem == null) return true; + // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then + // forcibly abort the work item (this aborts the underlying thread). if (!m_InSelfDelete) { // m_log.ErrorFormat("[SCRIPT INSTANCE]: Aborting script {0} {1}", ScriptName, ItemID); - result.Abort(); + + workItem.Abort(); } lock (m_EventQueue) { - m_CurrentResult = null; + m_CurrentWorkItem = null; } return true; @@ -606,6 +620,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance throw new EventAbortException(); } + /// + /// Post an event to this script instance. + /// + /// + /// The request to run the event is sent + /// + /// public void PostEvent(EventParams data) { // m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", @@ -672,9 +693,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_EventQueue.Enqueue(data); - if (m_CurrentResult == null) + if (m_CurrentWorkItem == null) { - m_CurrentResult = m_Engine.QueueEventHandler(this); + m_CurrentWorkItem = m_Engine.QueueEventHandler(this); } } } @@ -701,11 +722,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) { - m_CurrentResult = m_Engine.QueueEventHandler(this); + m_CurrentWorkItem = m_Engine.QueueEventHandler(this); } else { - m_CurrentResult = null; + m_CurrentWorkItem = null; } return 0; } @@ -825,15 +846,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance } } + + // If there are more events and we are currently running and not shutting down, then ask the + // script engine to run the next event. lock (m_EventQueue) { if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) { - m_CurrentResult = m_Engine.QueueEventHandler(this); + m_CurrentWorkItem = m_Engine.QueueEventHandler(this); } else { - m_CurrentResult = null; + m_CurrentWorkItem = null; } } @@ -943,8 +967,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance public void SaveState(string assembly) { - - // If we're currently in an event, just tell it to save upon return // if (m_InEvent) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 66349e3..ab41873 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -990,7 +990,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine lock (m_Scripts) { // Create the object record - if ((!m_Scripts.ContainsKey(itemID)) || (m_Scripts[itemID].AssetID != assetID)) { -- cgit v1.1 From 5a095723932a94f024dfde3f0266818e0456dade Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 13 Mar 2012 20:14:51 -0700 Subject: Minor sanity check on simulation agent handler (content type) --- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 1d1f9ef..5c9be8f 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -272,23 +272,28 @@ namespace OpenSim.Server.Handlers.Simulation keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); - Stream inputStream; + httpResponse.StatusCode = 200; + httpResponse.ContentType = "text/html"; + httpResponse.KeepAlive = false; + Encoding encoding = Encoding.UTF8; + + Stream inputStream = null; if (httpRequest.ContentType == "application/x-gzip") inputStream = new GZipStream(request, CompressionMode.Decompress); - else + else if (httpRequest.ContentType == "application/json") inputStream = request; + else // no go + { + httpResponse.StatusCode = 406; + return encoding.GetBytes("false"); + } - Encoding encoding = Encoding.UTF8; StreamReader reader = new StreamReader(inputStream, encoding); string requestBody = reader.ReadToEnd(); reader.Close(); keysvals.Add("body", requestBody); - httpResponse.StatusCode = 200; - httpResponse.ContentType = "text/html"; - httpResponse.KeepAlive = false; - Hashtable responsedata = new Hashtable(); UUID agentID; -- cgit v1.1 From 479dd65a63a45923d874f22abea442df88f8101f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 13 Mar 2012 20:15:38 -0700 Subject: Teleports: bounce off repeated requests of teleporting the same agent. Some scripts do that, and that fails the whole thing. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f6e4dbf..bef012d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -304,6 +304,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } + if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. + return; + m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); @@ -1861,6 +1864,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + protected bool IsInTransit(UUID id) + { + lock (m_agentsInTransit) + { + if (m_agentsInTransit.Contains(id)) + return true; + } + return false; + } + protected bool ResetFromTransit(UUID id) { lock (m_agentsInTransit) -- cgit v1.1