diff options
15 files changed, 148 insertions, 75 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 692ade7..7b634e2 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Data.MySQL | |||
162 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) | 162 | using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress)) |
163 | { | 163 | { |
164 | MemoryStream outputStream = new MemoryStream(); | 164 | MemoryStream outputStream = new MemoryStream(); |
165 | WebUtil.CopyTo(decompressionStream, outputStream, int.MaxValue); | 165 | WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue); |
166 | // int compressedLength = asset.Data.Length; | 166 | // int compressedLength = asset.Data.Length; |
167 | asset.Data = outputStream.ToArray(); | 167 | asset.Data = outputStream.ToArray(); |
168 | 168 | ||
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 | |||
119 | // Copy the temporary stream to the network stream | 119 | // Copy the temporary stream to the network stream |
120 | formDataStream.Seek(0, SeekOrigin.Begin); | 120 | formDataStream.Seek(0, SeekOrigin.Begin); |
121 | using (Stream requestStream = request.GetRequestStream()) | 121 | using (Stream requestStream = request.GetRequestStream()) |
122 | formDataStream.CopyTo(requestStream, (int)formDataStream.Length); | 122 | formDataStream.CopyStream(requestStream, (int)formDataStream.Length); |
123 | } | 123 | } |
124 | 124 | ||
125 | #endregion Stream Writing | 125 | #endregion Stream Writing |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 71a56e5..aac575c 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -511,8 +511,13 @@ namespace OpenSim.Framework | |||
511 | /// <remarks> | 511 | /// <remarks> |
512 | /// Copying begins at the streams' current positions. The positions are | 512 | /// Copying begins at the streams' current positions. The positions are |
513 | /// NOT reset after copying is complete. | 513 | /// NOT reset after copying is complete. |
514 | /// NOTE!! .NET 4.0 adds the method 'Stream.CopyTo(stream, bufferSize)'. | ||
515 | /// This function could be replaced with that method once we move | ||
516 | /// totally to .NET 4.0. For versions before, this routine exists. | ||
517 | /// This routine used to be named 'CopyTo' but the int parameter has | ||
518 | /// a different meaning so this method was renamed to avoid any confusion. | ||
514 | /// </remarks> | 519 | /// </remarks> |
515 | public static int CopyTo(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) | 520 | public static int CopyStream(this Stream copyFrom, Stream copyTo, int maximumBytesToCopy) |
516 | { | 521 | { |
517 | byte[] buffer = new byte[4096]; | 522 | byte[] buffer = new byte[4096]; |
518 | int readBytes; | 523 | int readBytes; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 60a8f86..feab40e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -305,6 +305,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
305 | return; | 305 | return; |
306 | } | 306 | } |
307 | 307 | ||
308 | if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | ||
309 | return; | ||
310 | |||
308 | m_log.DebugFormat( | 311 | m_log.DebugFormat( |
309 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", | 312 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", |
310 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 313 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
@@ -1825,6 +1828,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1825 | } | 1828 | } |
1826 | } | 1829 | } |
1827 | 1830 | ||
1831 | protected bool IsInTransit(UUID id) | ||
1832 | { | ||
1833 | lock (m_agentsInTransit) | ||
1834 | { | ||
1835 | if (m_agentsInTransit.Contains(id)) | ||
1836 | return true; | ||
1837 | } | ||
1838 | return false; | ||
1839 | } | ||
1840 | |||
1828 | protected bool ResetFromTransit(UUID id) | 1841 | protected bool ResetFromTransit(UUID id) |
1829 | { | 1842 | { |
1830 | lock (m_agentsInTransit) | 1843 | lock (m_agentsInTransit) |
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 | |||
46 | private DataSnapshotManager m_externalData = null; | 46 | private DataSnapshotManager m_externalData = null; |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private readonly string m_discoveryPath = "DS0001/"; | ||
50 | |||
51 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) | 49 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) |
52 | { | 50 | { |
53 | m_scene = scene; | 51 | m_scene = scene; |
@@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot | |||
58 | { | 56 | { |
59 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); | 57 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); |
60 | } | 58 | } |
59 | // Register validation callback handler | ||
60 | MainServer.Instance.AddHTTPHandler("validate", OnValidate); | ||
61 | 61 | ||
62 | //Register CAPS handler event | ||
63 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
64 | |||
65 | //harbl | ||
66 | } | ||
67 | |||
68 | public void OnRegisterCaps(UUID agentID, Caps caps) | ||
69 | { | ||
70 | // m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID); | ||
71 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | ||
72 | caps.RegisterHandler("PublicSnapshotDataInfo", | ||
73 | new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt)); | ||
74 | } | ||
75 | |||
76 | public string OnDiscoveryAttempt(string request, string path, string param, | ||
77 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
78 | { | ||
79 | //Very static for now, flexible enough to add new formats | ||
80 | LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse(); | ||
81 | llsd_response.snapshot_resources = new OSDArray(); | ||
82 | |||
83 | LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL(); | ||
84 | llsd_dataurl.snapshot_format = "os-datasnapshot-v1"; | ||
85 | llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector"; | ||
86 | |||
87 | llsd_response.snapshot_resources.Array.Add(llsd_dataurl); | ||
88 | |||
89 | string response = LLSDHelpers.SerialiseLLSDReply(llsd_response); | ||
90 | |||
91 | return response; | ||
92 | } | 62 | } |
93 | 63 | ||
94 | public Hashtable OnGetSnapshot(Hashtable keysvals) | 64 | public Hashtable OnGetSnapshot(Hashtable keysvals) |
@@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot | |||
107 | 77 | ||
108 | return reply; | 78 | return reply; |
109 | } | 79 | } |
80 | |||
81 | public Hashtable OnValidate(Hashtable keysvals) | ||
82 | { | ||
83 | m_log.Info("[DATASNAPSHOT] Received validation request"); | ||
84 | Hashtable reply = new Hashtable(); | ||
85 | int statuscode = 200; | ||
86 | |||
87 | string secret = (string)keysvals["secret"]; | ||
88 | if (secret == m_externalData.Secret.ToString()) | ||
89 | statuscode = 403; | ||
90 | |||
91 | reply["str_response_string"] = string.Empty; | ||
92 | reply["int_response_code"] = statuscode; | ||
93 | reply["content_type"] = "text/plain"; | ||
94 | |||
95 | return reply; | ||
96 | } | ||
97 | |||
110 | } | 98 | } |
111 | } | 99 | } |
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 9fc002b..5540656 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot | |||
66 | private string m_dataServices = "noservices"; | 66 | private string m_dataServices = "noservices"; |
67 | public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); | 67 | public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); |
68 | public string m_hostname = "127.0.0.1"; | 68 | public string m_hostname = "127.0.0.1"; |
69 | private UUID m_Secret = UUID.Random(); | ||
69 | 70 | ||
70 | //Update timers | 71 | //Update timers |
71 | private int m_period = 20; // in seconds | 72 | private int m_period = 20; // in seconds |
@@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot | |||
85 | get { return m_exposure_level; } | 86 | get { return m_exposure_level; } |
86 | } | 87 | } |
87 | 88 | ||
89 | public UUID Secret | ||
90 | { | ||
91 | get { return m_Secret; } | ||
92 | } | ||
93 | |||
88 | #endregion | 94 | #endregion |
89 | 95 | ||
90 | #region IRegionModule | 96 | #region IRegionModule |
@@ -103,10 +109,10 @@ namespace OpenSim.Region.DataSnapshot | |||
103 | m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); | 109 | m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); |
104 | IConfig conf = config.Configs["GridService"]; | 110 | IConfig conf = config.Configs["GridService"]; |
105 | if (conf != null) | 111 | if (conf != null) |
106 | m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003")); | 112 | m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty)); |
107 | 113 | ||
108 | m_gridinfo.Add( | 114 | m_gridinfo.Add( |
109 | "Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo")); | 115 | "name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo")); |
110 | m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level); | 116 | m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level); |
111 | m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); | 117 | m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); |
112 | m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); | 118 | m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); |
@@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot | |||
315 | cli.AddQueryParameter("service", serviceName); | 321 | cli.AddQueryParameter("service", serviceName); |
316 | cli.AddQueryParameter("host", m_hostname); | 322 | cli.AddQueryParameter("host", m_hostname); |
317 | cli.AddQueryParameter("port", m_listener_port); | 323 | cli.AddQueryParameter("port", m_listener_port); |
324 | cli.AddQueryParameter("secret", m_Secret.ToString()); | ||
318 | cli.RequestMethod = "GET"; | 325 | cli.RequestMethod = "GET"; |
319 | try | 326 | try |
320 | { | 327 | { |
@@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot | |||
341 | } | 348 | } |
342 | // This is not quite working, so... | 349 | // This is not quite working, so... |
343 | // string responseStr = Util.UTF8.GetString(response); | 350 | // string responseStr = Util.UTF8.GetString(response); |
344 | m_log.Info("[DATASNAPSHOT]: data service notified: " + url); | 351 | m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret); |
345 | } | 352 | } |
346 | 353 | ||
347 | } | 354 | } |
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 | |||
89 | void Start(); | 89 | void Start(); |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Stop the script. | 92 | /// Stop the script instance. |
93 | /// </summary> | 93 | /// </summary> |
94 | /// <param name="timeout"></param> | 94 | /// <param name="timeout"></param> |
95 | /// <returns>true if the script was successfully stopped, false otherwise</returns> | 95 | /// <returns>true if the script was successfully stopped, false otherwise</returns> |
@@ -97,13 +97,17 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
97 | 97 | ||
98 | void SetState(string state); | 98 | void SetState(string state); |
99 | 99 | ||
100 | /// <summary> | ||
101 | /// Post an event to this script instance. | ||
102 | /// </summary> | ||
103 | /// <param name="data"></param> | ||
100 | void PostEvent(EventParams data); | 104 | void PostEvent(EventParams data); |
101 | 105 | ||
102 | void Suspend(); | 106 | void Suspend(); |
103 | void Resume(); | 107 | void Resume(); |
104 | 108 | ||
105 | /// <summary> | 109 | /// <summary> |
106 | /// Process the next event queued for this script | 110 | /// Process the next event queued for this script instance. |
107 | /// </summary> | 111 | /// </summary> |
108 | /// <returns></returns> | 112 | /// <returns></returns> |
109 | object EventProcessor(); | 113 | object EventProcessor(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ecc5fb5..8dfc7d2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2102,6 +2102,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2102 | return HomeURI; | 2102 | return HomeURI; |
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | public string osGetGridGatekeeperURI() | ||
2106 | { | ||
2107 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); | ||
2108 | m_host.AddScriptLPS(1); | ||
2109 | |||
2110 | string gatekeeperURI = String.Empty; | ||
2111 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2112 | |||
2113 | if (config.Configs["GridService"] != null) | ||
2114 | gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI); | ||
2115 | |||
2116 | return gatekeeperURI; | ||
2117 | } | ||
2118 | |||
2105 | public string osGetGridCustom(string key) | 2119 | public string osGetGridCustom(string key) |
2106 | { | 2120 | { |
2107 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); | 2121 | 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 fb52600..e59d3a8 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 | |||
161 | string osGetGridName(); | 161 | string osGetGridName(); |
162 | string osGetGridLoginURI(); | 162 | string osGetGridLoginURI(); |
163 | string osGetGridHomeURI(); | 163 | string osGetGridHomeURI(); |
164 | string osGetGridGatekeeperURI(); | ||
164 | string osGetGridCustom(string key); | 165 | string osGetGridCustom(string key); |
165 | 166 | ||
166 | LSL_String osFormatString(string str, LSL_List strings); | 167 | 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 | |||
457 | return m_OSSL_Functions.osGetGridHomeURI(); | 457 | return m_OSSL_Functions.osGetGridHomeURI(); |
458 | } | 458 | } |
459 | 459 | ||
460 | public string osGetGridGatekeeperURI() | ||
461 | { | ||
462 | return m_OSSL_Functions.osGetGridGatekeeperURI(); | ||
463 | } | ||
464 | |||
460 | public string osGetGridCustom(string key) | 465 | public string osGetGridCustom(string key) |
461 | { | 466 | { |
462 | return m_OSSL_Functions.osGetGridCustom(key); | 467 | return m_OSSL_Functions.osGetGridCustom(key); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index da2ef7b..6d56437 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -59,7 +59,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
60 | 60 | ||
61 | private IScriptEngine m_Engine; | 61 | private IScriptEngine m_Engine; |
62 | private IScriptWorkItem m_CurrentResult = null; | 62 | |
63 | /// <summary> | ||
64 | /// The current work item if an event for this script is running or waiting to run, | ||
65 | /// </summary> | ||
66 | /// <remarks> | ||
67 | /// Null if there is no running or waiting to run event. Must be changed only under an m_EventQueue lock. | ||
68 | /// </remarks> | ||
69 | private IScriptWorkItem m_CurrentWorkItem; | ||
70 | |||
63 | private Queue m_EventQueue = new Queue(32); | 71 | private Queue m_EventQueue = new Queue(32); |
64 | private bool m_RunEvents = false; | 72 | private bool m_RunEvents = false; |
65 | private UUID m_ItemID; | 73 | private UUID m_ItemID; |
@@ -158,7 +166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
158 | { | 166 | { |
159 | // Need to place ourselves back in a work item if there are events to process | 167 | // Need to place ourselves back in a work item if there are events to process |
160 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 168 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) |
161 | m_CurrentResult = m_Engine.QueueEventHandler(this); | 169 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
162 | } | 170 | } |
163 | } | 171 | } |
164 | } | 172 | } |
@@ -528,8 +536,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
528 | 536 | ||
529 | if (m_EventQueue.Count > 0) | 537 | if (m_EventQueue.Count > 0) |
530 | { | 538 | { |
531 | if (m_CurrentResult == null) | 539 | if (m_CurrentWorkItem == null) |
532 | m_CurrentResult = m_Engine.QueueEventHandler(this); | 540 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
533 | // else | 541 | // else |
534 | // m_log.Error("[Script] Tried to start a script that was already queued"); | 542 | // m_log.Error("[Script] Tried to start a script that was already queued"); |
535 | } | 543 | } |
@@ -541,49 +549,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
541 | // m_log.DebugFormat( | 549 | // m_log.DebugFormat( |
542 | // "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout); | 550 | // "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout); |
543 | 551 | ||
544 | IScriptWorkItem result; | 552 | IScriptWorkItem workItem; |
545 | 553 | ||
546 | lock (m_EventQueue) | 554 | lock (m_EventQueue) |
547 | { | 555 | { |
548 | if (!Running) | 556 | if (!Running) |
549 | return true; | 557 | return true; |
550 | 558 | ||
551 | if (m_CurrentResult == null) | 559 | // If we're not running or waiting to run an event then we can safely stop. |
560 | if (m_CurrentWorkItem == null) | ||
552 | { | 561 | { |
553 | m_RunEvents = false; | 562 | m_RunEvents = false; |
554 | return true; | 563 | return true; |
555 | } | 564 | } |
556 | 565 | ||
557 | if (m_CurrentResult.Cancel()) | 566 | // If we are waiting to run an event then we can try to cancel it. |
567 | if (m_CurrentWorkItem.Cancel()) | ||
558 | { | 568 | { |
559 | m_CurrentResult = null; | 569 | m_CurrentWorkItem = null; |
560 | m_RunEvents = false; | 570 | m_RunEvents = false; |
561 | return true; | 571 | return true; |
562 | } | 572 | } |
563 | 573 | ||
564 | result = m_CurrentResult; | 574 | workItem = m_CurrentWorkItem; |
565 | m_RunEvents = false; | 575 | m_RunEvents = false; |
566 | } | 576 | } |
567 | 577 | ||
568 | if (result.Wait(new TimeSpan((long)timeout * 100000))) | 578 | // Wait for the current event to complete. |
579 | if (workItem.Wait(new TimeSpan((long)timeout * 100000))) | ||
569 | { | 580 | { |
570 | return true; | 581 | return true; |
571 | } | 582 | } |
572 | 583 | ||
573 | lock (m_EventQueue) | 584 | lock (m_EventQueue) |
574 | { | 585 | { |
575 | result = m_CurrentResult; | 586 | workItem = m_CurrentWorkItem; |
576 | } | 587 | } |
577 | 588 | ||
578 | if (result == null) | 589 | if (workItem == null) |
579 | return true; | 590 | return true; |
580 | 591 | ||
592 | // If the event still hasn't stopped and we the stop isn't the result of script or object removal, then | ||
593 | // forcibly abort the work item (this aborts the underlying thread). | ||
581 | if (!m_InSelfDelete) | 594 | if (!m_InSelfDelete) |
582 | result.Abort(); | 595 | { |
596 | // m_log.ErrorFormat("[SCRIPT INSTANCE]: Aborting script {0} {1}", ScriptName, ItemID); | ||
597 | |||
598 | workItem.Abort(); | ||
599 | } | ||
583 | 600 | ||
584 | lock (m_EventQueue) | 601 | lock (m_EventQueue) |
585 | { | 602 | { |
586 | m_CurrentResult = null; | 603 | m_CurrentWorkItem = null; |
587 | } | 604 | } |
588 | 605 | ||
589 | return true; | 606 | return true; |
@@ -605,6 +622,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
605 | throw new EventAbortException(); | 622 | throw new EventAbortException(); |
606 | } | 623 | } |
607 | 624 | ||
625 | /// <summary> | ||
626 | /// Post an event to this script instance. | ||
627 | /// </summary> | ||
628 | /// <remarks> | ||
629 | /// The request to run the event is sent | ||
630 | /// </remarks> | ||
631 | /// <param name="data"></param> | ||
608 | public void PostEvent(EventParams data) | 632 | public void PostEvent(EventParams data) |
609 | { | 633 | { |
610 | // m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", | 634 | // m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}", |
@@ -671,9 +695,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
671 | 695 | ||
672 | m_EventQueue.Enqueue(data); | 696 | m_EventQueue.Enqueue(data); |
673 | 697 | ||
674 | if (m_CurrentResult == null) | 698 | if (m_CurrentWorkItem == null) |
675 | { | 699 | { |
676 | m_CurrentResult = m_Engine.QueueEventHandler(this); | 700 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
677 | } | 701 | } |
678 | } | 702 | } |
679 | } | 703 | } |
@@ -698,11 +722,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
698 | { | 722 | { |
699 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 723 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) |
700 | { | 724 | { |
701 | m_CurrentResult = m_Engine.QueueEventHandler(this); | 725 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) |
726 | { | ||
727 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); | ||
728 | } | ||
729 | else | ||
730 | { | ||
731 | m_CurrentWorkItem = null; | ||
732 | } | ||
733 | return 0; | ||
702 | } | 734 | } |
703 | else | 735 | else |
704 | { | 736 | { |
705 | m_CurrentResult = null; | 737 | m_CurrentWorkItem = null; |
706 | } | 738 | } |
707 | return 0; | 739 | return 0; |
708 | } | 740 | } |
@@ -825,15 +857,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
825 | } | 857 | } |
826 | } | 858 | } |
827 | 859 | ||
860 | |||
861 | // If there are more events and we are currently running and not shutting down, then ask the | ||
862 | // script engine to run the next event. | ||
828 | lock (m_EventQueue) | 863 | lock (m_EventQueue) |
829 | { | 864 | { |
830 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 865 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) |
831 | { | 866 | { |
832 | m_CurrentResult = m_Engine.QueueEventHandler(this); | 867 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
833 | } | 868 | } |
834 | else | 869 | else |
835 | { | 870 | { |
836 | m_CurrentResult = null; | 871 | m_CurrentWorkItem = null; |
837 | } | 872 | } |
838 | } | 873 | } |
839 | 874 | ||
@@ -941,8 +976,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
941 | 976 | ||
942 | public void SaveState(string assembly) | 977 | public void SaveState(string assembly) |
943 | { | 978 | { |
944 | |||
945 | |||
946 | // If we're currently in an event, just tell it to save upon return | 979 | // If we're currently in an event, just tell it to save upon return |
947 | // | 980 | // |
948 | if (m_InEvent) | 981 | if (m_InEvent) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index db6a407..1d3ba6c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -452,6 +452,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
452 | 452 | ||
453 | sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); | 453 | sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); |
454 | sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); | 454 | sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); |
455 | sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); | ||
456 | sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads); | ||
455 | sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); | 457 | sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); |
456 | sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); | 458 | sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); |
457 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); | 459 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index ded335d5..8f6fa52 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -295,23 +295,28 @@ namespace OpenSim.Server.Handlers.Simulation | |||
295 | keysvals.Add("headers", headervals); | 295 | keysvals.Add("headers", headervals); |
296 | keysvals.Add("querystringkeys", querystringkeys); | 296 | keysvals.Add("querystringkeys", querystringkeys); |
297 | 297 | ||
298 | Stream inputStream; | 298 | httpResponse.StatusCode = 200; |
299 | httpResponse.ContentType = "text/html"; | ||
300 | httpResponse.KeepAlive = false; | ||
301 | Encoding encoding = Encoding.UTF8; | ||
302 | |||
303 | Stream inputStream = null; | ||
299 | if (httpRequest.ContentType == "application/x-gzip") | 304 | if (httpRequest.ContentType == "application/x-gzip") |
300 | inputStream = new GZipStream(request, CompressionMode.Decompress); | 305 | inputStream = new GZipStream(request, CompressionMode.Decompress); |
301 | else | 306 | else if (httpRequest.ContentType == "application/json") |
302 | inputStream = request; | 307 | inputStream = request; |
308 | else // no go | ||
309 | { | ||
310 | httpResponse.StatusCode = 406; | ||
311 | return encoding.GetBytes("false"); | ||
312 | } | ||
303 | 313 | ||
304 | Encoding encoding = Encoding.UTF8; | ||
305 | StreamReader reader = new StreamReader(inputStream, encoding); | 314 | StreamReader reader = new StreamReader(inputStream, encoding); |
306 | 315 | ||
307 | string requestBody = reader.ReadToEnd(); | 316 | string requestBody = reader.ReadToEnd(); |
308 | reader.Close(); | 317 | reader.Close(); |
309 | keysvals.Add("body", requestBody); | 318 | keysvals.Add("body", requestBody); |
310 | 319 | ||
311 | httpResponse.StatusCode = 200; | ||
312 | httpResponse.ContentType = "text/html"; | ||
313 | httpResponse.KeepAlive = false; | ||
314 | |||
315 | Hashtable responsedata = new Hashtable(); | 320 | Hashtable responsedata = new Hashtable(); |
316 | 321 | ||
317 | UUID agentID; | 322 | UUID agentID; |
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 | |||
477 | // Grab the asset data from the response stream | 477 | // Grab the asset data from the response stream |
478 | using (MemoryStream stream = new MemoryStream()) | 478 | using (MemoryStream stream = new MemoryStream()) |
479 | { | 479 | { |
480 | responseStream.CopyTo(stream, 4096); | 480 | responseStream.CopyStream(stream, Int32.MaxValue); |
481 | asset.Data = stream.ToArray(); | 481 | asset.Data = stream.ToArray(); |
482 | } | 482 | } |
483 | } | 483 | } |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 08a6194..1f3cd0d 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -172,6 +172,7 @@ | |||
172 | 172 | ||
173 | ;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule | 173 | ;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule |
174 | ;; Permission modules to use, separated by comma. | 174 | ;; Permission modules to use, separated by comma. |
175 | ;; Possible modules are DefaultPermissionsModule, PrimLimitsModule | ||
175 | ; permissionmodules = DefaultPermissionsModule | 176 | ; permissionmodules = DefaultPermissionsModule |
176 | 177 | ||
177 | ;# {serverside_object_permissions} {permissionmodules:DefaultPermissionsModule} {Activate permission handling by the sim?} {true false} true | 178 | ;# {serverside_object_permissions} {permissionmodules:DefaultPermissionsModule} {Activate permission handling by the sim?} {true false} true |
@@ -790,11 +791,6 @@ | |||
790 | ; Enabled = false | 791 | ; Enabled = false |
791 | 792 | ||
792 | 793 | ||
793 | [PrimLimitsModule] | ||
794 | ;# {EnforcePrimLimits} {} {Enforce parcel prim limits} {true false} false | ||
795 | ;; Enable parcel prim limits. Off by default to emulate pre-existing behavior. | ||
796 | ; EnforcePrimLimits = false | ||
797 | |||
798 | 794 | ||
799 | [Architecture] | 795 | [Architecture] |
800 | ;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini | 796 | ;# {Include-Architecture} {} {Choose one of the following architectures} {config-include/Standalone.ini config-include/StandaloneHypergrid.ini config-include/Grid.ini config-include/GridHypergrid.ini config-include/SimianGrid.ini config-include/HyperSimianGrid.ini} config-include/Standalone.ini |