diff options
author | Diva Canto | 2013-02-27 20:50:03 -0800 |
---|---|---|
committer | Diva Canto | 2013-02-27 20:50:03 -0800 |
commit | 64b8ce73dabcf651beadcc11cbe94db69cc3ea0e (patch) | |
tree | ab7f3a63c166185a5fd9d6d5a7e36a18d63a9817 /OpenSim/Region | |
parent | Moved the HG default variables out of [Startup] and into their own section [H... (diff) | |
parent | Add comment to example region modules about need to add Assembly annotation i... (diff) | |
download | opensim-SC_OLD-64b8ce73dabcf651beadcc11cbe94db69cc3ea0e.zip opensim-SC_OLD-64b8ce73dabcf651beadcc11cbe94db69cc3ea0e.tar.gz opensim-SC_OLD-64b8ce73dabcf651beadcc11cbe94db69cc3ea0e.tar.bz2 opensim-SC_OLD-64b8ce73dabcf651beadcc11cbe94db69cc3ea0e.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
19 files changed, 432 insertions, 118 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c4731a3..4075edb 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Linq; | ||
33 | using System.Reflection; | 34 | using System.Reflection; |
34 | using System.Text; | 35 | using System.Text; |
35 | using System.Text.RegularExpressions; | 36 | using System.Text.RegularExpressions; |
@@ -808,16 +809,28 @@ namespace OpenSim | |||
808 | break; | 809 | break; |
809 | 810 | ||
810 | case "modules": | 811 | case "modules": |
811 | SceneManager.ForEachScene( | 812 | SceneManager.ForEachSelectedScene( |
812 | delegate(Scene scene) { | 813 | scene => |
813 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
814 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
815 | { | 814 | { |
816 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 815 | MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); |
817 | string module_type = type != null ? "Shared" : "Non-Shared"; | 816 | |
818 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | 817 | List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>(); |
818 | List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>(); | ||
819 | |||
820 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
821 | { | ||
822 | if (module.GetType().GetInterface("ISharedRegionModule") != null) | ||
823 | nonSharedModules.Add(module); | ||
824 | else | ||
825 | sharedModules.Add(module); | ||
826 | } | ||
827 | |||
828 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
829 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | ||
830 | |||
831 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
832 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | ||
819 | } | 833 | } |
820 | } | ||
821 | ); | 834 | ); |
822 | 835 | ||
823 | MainConsole.Instance.Output(""); | 836 | MainConsole.Instance.Output(""); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3c8e199..c555915 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -668,7 +668,7 @@ namespace OpenSim | |||
668 | // listenIP = IPAddress.Parse("0.0.0.0"); | 668 | // listenIP = IPAddress.Parse("0.0.0.0"); |
669 | 669 | ||
670 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 670 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
671 | IClientNetworkServer clientNetworkServer; | 671 | |
672 | if (m_autoCreateClientStack) | 672 | if (m_autoCreateClientStack) |
673 | { | 673 | { |
674 | clientNetworkServers = m_clientStackManager.CreateServers( | 674 | clientNetworkServers = m_clientStackManager.CreateServers( |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index be617a5..c9cd412 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -117,20 +117,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
117 | /// </summary> | 117 | /// </summary> |
118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); | 118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); |
119 | 119 | ||
120 | /// <summary> | 120 | private uint m_HttpsPort = 0; |
121 | /// Maximum number of external urls that can be set up by this module. | ||
122 | /// </summary> | ||
123 | private int m_TotalUrls = 100; | ||
124 | |||
125 | private uint https_port = 0; | ||
126 | private IHttpServer m_HttpServer = null; | 121 | private IHttpServer m_HttpServer = null; |
127 | private IHttpServer m_HttpsServer = null; | 122 | private IHttpServer m_HttpsServer = null; |
128 | 123 | ||
129 | private string m_ExternalHostNameForLSL = ""; | 124 | public string ExternalHostNameForLSL { get; private set; } |
130 | public string ExternalHostNameForLSL | 125 | |
131 | { | 126 | /// <summary> |
132 | get { return m_ExternalHostNameForLSL; } | 127 | /// The default maximum number of urls |
133 | } | 128 | /// </summary> |
129 | public const int DefaultTotalUrls = 100; | ||
130 | |||
131 | /// <summary> | ||
132 | /// Maximum number of external urls that can be set up by this module. | ||
133 | /// </summary> | ||
134 | public int TotalUrls { get; set; } | ||
134 | 135 | ||
135 | public Type ReplaceableInterface | 136 | public Type ReplaceableInterface |
136 | { | 137 | { |
@@ -144,16 +145,27 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
144 | 145 | ||
145 | public void Initialise(IConfigSource config) | 146 | public void Initialise(IConfigSource config) |
146 | { | 147 | { |
147 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); | 148 | IConfig networkConfig = config.Configs["Network"]; |
148 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); | 149 | |
150 | if (networkConfig != null) | ||
151 | { | ||
152 | ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null); | ||
153 | |||
154 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false); | ||
155 | |||
156 | if (ssl_enabled) | ||
157 | m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); | ||
158 | } | ||
149 | 159 | ||
150 | if (ssl_enabled) | 160 | if (ExternalHostNameForLSL == null) |
151 | https_port = (uint) config.Configs["Network"].GetInt("https_port",0); | 161 | ExternalHostNameForLSL = System.Environment.MachineName; |
152 | 162 | ||
153 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; | 163 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; |
154 | 164 | ||
155 | if (llFunctionsConfig != null) | 165 | if (llFunctionsConfig != null) |
156 | m_TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", m_TotalUrls); | 166 | TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", DefaultTotalUrls); |
167 | else | ||
168 | TotalUrls = DefaultTotalUrls; | ||
157 | } | 169 | } |
158 | 170 | ||
159 | public void PostInitialise() | 171 | public void PostInitialise() |
@@ -169,9 +181,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
169 | m_HttpServer = MainServer.Instance; | 181 | m_HttpServer = MainServer.Instance; |
170 | // | 182 | // |
171 | // We can use the https if it is enabled | 183 | // We can use the https if it is enabled |
172 | if (https_port > 0) | 184 | if (m_HttpsPort > 0) |
173 | { | 185 | { |
174 | m_HttpsServer = MainServer.GetHttpServer(https_port); | 186 | m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort); |
175 | } | 187 | } |
176 | } | 188 | } |
177 | 189 | ||
@@ -204,12 +216,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
204 | 216 | ||
205 | lock (m_UrlMap) | 217 | lock (m_UrlMap) |
206 | { | 218 | { |
207 | if (m_UrlMap.Count >= m_TotalUrls) | 219 | if (m_UrlMap.Count >= TotalUrls) |
208 | { | 220 | { |
209 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 221 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
210 | return urlcode; | 222 | return urlcode; |
211 | } | 223 | } |
212 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 224 | string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; |
213 | 225 | ||
214 | UrlData urlData = new UrlData(); | 226 | UrlData urlData = new UrlData(); |
215 | urlData.hostID = host.UUID; | 227 | urlData.hostID = host.UUID; |
@@ -249,12 +261,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
249 | 261 | ||
250 | lock (m_UrlMap) | 262 | lock (m_UrlMap) |
251 | { | 263 | { |
252 | if (m_UrlMap.Count >= m_TotalUrls) | 264 | if (m_UrlMap.Count >= TotalUrls) |
253 | { | 265 | { |
254 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 266 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
255 | return urlcode; | 267 | return urlcode; |
256 | } | 268 | } |
257 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | 269 | string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; |
258 | 270 | ||
259 | UrlData urlData = new UrlData(); | 271 | UrlData urlData = new UrlData(); |
260 | urlData.hostID = host.UUID; | 272 | urlData.hostID = host.UUID; |
@@ -377,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
377 | public int GetFreeUrls() | 389 | public int GetFreeUrls() |
378 | { | 390 | { |
379 | lock (m_UrlMap) | 391 | lock (m_UrlMap) |
380 | return m_TotalUrls - m_UrlMap.Count; | 392 | return TotalUrls - m_UrlMap.Count; |
381 | } | 393 | } |
382 | 394 | ||
383 | public void ScriptRemoved(UUID itemID) | 395 | public void ScriptRemoved(UUID itemID) |
@@ -579,9 +591,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
579 | string url; | 591 | string url; |
580 | 592 | ||
581 | if (is_ssl) | 593 | if (is_ssl) |
582 | url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; | 594 | url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
583 | else | 595 | else |
584 | url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; | 596 | url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
585 | 597 | ||
586 | // Avoid a race - the request URL may have been released via llRequestUrl() whilst this | 598 | // Avoid a race - the request URL may have been released via llRequestUrl() whilst this |
587 | // request was being processed. | 599 | // request was being processed. |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 689e8a7..f04fabe 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -838,13 +838,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
838 | try | 838 | try |
839 | { | 839 | { |
840 | WebRequest request = HttpWebRequest.Create(url); | 840 | WebRequest request = HttpWebRequest.Create(url); |
841 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 841 | |
842 | //Ckrinke Stream str = null; | 842 | using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse()) |
843 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); | ||
844 | if (response.StatusCode == HttpStatusCode.OK) | ||
845 | { | 843 | { |
846 | Bitmap image = new Bitmap(response.GetResponseStream()); | 844 | if (response.StatusCode == HttpStatusCode.OK) |
847 | return image; | 845 | { |
846 | using (Stream s = response.GetResponseStream()) | ||
847 | { | ||
848 | Bitmap image = new Bitmap(s); | ||
849 | return image; | ||
850 | } | ||
851 | } | ||
848 | } | 852 | } |
849 | } | 853 | } |
850 | catch { } | 854 | catch { } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 912d50a..c50ab64 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -868,20 +868,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
868 | } | 868 | } |
869 | 869 | ||
870 | string response_mapItems_reply = null; | 870 | string response_mapItems_reply = null; |
871 | { // get the response | 871 | { |
872 | StreamReader sr = null; | ||
873 | try | 872 | try |
874 | { | 873 | { |
875 | WebResponse webResponse = mapitemsrequest.GetResponse(); | 874 | using (WebResponse webResponse = mapitemsrequest.GetResponse()) |
876 | if (webResponse != null) | ||
877 | { | ||
878 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
879 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
880 | } | ||
881 | else | ||
882 | { | 875 | { |
883 | return new OSDMap(); | 876 | if (webResponse != null) |
884 | } | 877 | { |
878 | using (Stream s = webResponse.GetResponseStream()) | ||
879 | using (StreamReader sr = new StreamReader(s)) | ||
880 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
881 | } | ||
882 | else | ||
883 | { | ||
884 | return new OSDMap(); | ||
885 | } | ||
886 | } | ||
885 | } | 887 | } |
886 | catch (WebException) | 888 | catch (WebException) |
887 | { | 889 | { |
@@ -908,11 +910,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
908 | 910 | ||
909 | return responseMap; | 911 | return responseMap; |
910 | } | 912 | } |
911 | finally | ||
912 | { | ||
913 | if (sr != null) | ||
914 | sr.Close(); | ||
915 | } | ||
916 | 913 | ||
917 | OSD rezResponse = null; | 914 | OSD rezResponse = null; |
918 | try | 915 | try |
@@ -926,6 +923,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
926 | { | 923 | { |
927 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); | 924 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); |
928 | responseMap["connect"] = OSD.FromBoolean(false); | 925 | responseMap["connect"] = OSD.FromBoolean(false); |
926 | |||
929 | lock (m_blacklistedregions) | 927 | lock (m_blacklistedregions) |
930 | { | 928 | { |
931 | if (!m_blacklistedregions.ContainsKey(regionhandle)) | 929 | if (!m_blacklistedregions.ContainsKey(regionhandle)) |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48..ced4e91 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | string GetXMLState(UUID itemID); | 52 | string GetXMLState(UUID itemID); |
53 | bool SetXMLState(UUID itemID, string xml); | 53 | bool SetXMLState(UUID itemID, string xml); |
54 | 54 | ||
55 | /// <summary> | ||
56 | /// Post a script event to a single script. | ||
57 | /// </summary> | ||
58 | /// <returns>true if the post suceeded, false if it did not</returns> | ||
59 | /// <param name='itemID'>The item ID of the script.</param> | ||
60 | /// <param name='name'>The name of the event.</param> | ||
61 | /// <param name='args'> | ||
62 | /// The arguments of the event. These are in the order in which they appear. | ||
63 | /// e.g. for http_request this will be an object array of key request_id, string method, string body | ||
64 | /// </param> | ||
55 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 65 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
66 | |||
56 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 67 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
57 | 68 | ||
58 | /// <summary> | 69 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 1e2e973..780bd01 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -331,35 +331,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
331 | 331 | ||
332 | public void SendCommandToPluginModules(string[] cmdparams) | 332 | public void SendCommandToPluginModules(string[] cmdparams) |
333 | { | 333 | { |
334 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 334 | ForEachSelectedScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
335 | } | 335 | } |
336 | 336 | ||
337 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 337 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
338 | { | 338 | { |
339 | ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); | 339 | ForEachSelectedScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); |
340 | } | 340 | } |
341 | 341 | ||
342 | private void ForEachCurrentScene(Action<Scene> func) | 342 | public void ForEachSelectedScene(Action<Scene> func) |
343 | { | 343 | { |
344 | if (CurrentScene == null) | 344 | if (CurrentScene == null) |
345 | { | 345 | ForEachScene(func); |
346 | lock (m_localScenes) | ||
347 | m_localScenes.ForEach(func); | ||
348 | } | ||
349 | else | 346 | else |
350 | { | ||
351 | func(CurrentScene); | 347 | func(CurrentScene); |
352 | } | ||
353 | } | 348 | } |
354 | 349 | ||
355 | public void RestartCurrentScene() | 350 | public void RestartCurrentScene() |
356 | { | 351 | { |
357 | ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); }); | 352 | ForEachSelectedScene(delegate(Scene scene) { scene.RestartNow(); }); |
358 | } | 353 | } |
359 | 354 | ||
360 | public void BackupCurrentScene() | 355 | public void BackupCurrentScene() |
361 | { | 356 | { |
362 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); | 357 | ForEachSelectedScene(delegate(Scene scene) { scene.Backup(true); }); |
363 | } | 358 | } |
364 | 359 | ||
365 | public bool TrySetCurrentScene(string regionName) | 360 | public bool TrySetCurrentScene(string regionName) |
@@ -490,7 +485,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
490 | /// <param name="name">Name of avatar to debug</param> | 485 | /// <param name="name">Name of avatar to debug</param> |
491 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) | 486 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) |
492 | { | 487 | { |
493 | ForEachCurrentScene(scene => | 488 | ForEachSelectedScene(scene => |
494 | scene.ForEachScenePresence(sp => | 489 | scene.ForEachScenePresence(sp => |
495 | { | 490 | { |
496 | if (name == null || sp.Name == name) | 491 | if (name == null || sp.Name == name) |
@@ -509,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
509 | { | 504 | { |
510 | List<ScenePresence> avatars = new List<ScenePresence>(); | 505 | List<ScenePresence> avatars = new List<ScenePresence>(); |
511 | 506 | ||
512 | ForEachCurrentScene( | 507 | ForEachSelectedScene( |
513 | delegate(Scene scene) | 508 | delegate(Scene scene) |
514 | { | 509 | { |
515 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 510 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
@@ -526,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
526 | { | 521 | { |
527 | List<ScenePresence> presences = new List<ScenePresence>(); | 522 | List<ScenePresence> presences = new List<ScenePresence>(); |
528 | 523 | ||
529 | ForEachCurrentScene(delegate(Scene scene) | 524 | ForEachSelectedScene(delegate(Scene scene) |
530 | { | 525 | { |
531 | scene.ForEachScenePresence(delegate(ScenePresence sp) | 526 | scene.ForEachScenePresence(delegate(ScenePresence sp) |
532 | { | 527 | { |
@@ -555,12 +550,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
555 | 550 | ||
556 | public void ForceCurrentSceneClientUpdate() | 551 | public void ForceCurrentSceneClientUpdate() |
557 | { | 552 | { |
558 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 553 | ForEachSelectedScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
559 | } | 554 | } |
560 | 555 | ||
561 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 556 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
562 | { | 557 | { |
563 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 558 | ForEachSelectedScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
564 | } | 559 | } |
565 | 560 | ||
566 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) | 561 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 37ab35a..ef1b92e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
551 | reqStream.Close(); | 551 | reqStream.Close(); |
552 | } | 552 | } |
553 | 553 | ||
554 | HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); | 554 | using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse()) |
555 | Encoding encoding = Util.UTF8; | 555 | { |
556 | StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); | 556 | Encoding encoding = Util.UTF8; |
557 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | 557 | |
558 | fwdresponsecontenttype = fwdrsp.ContentType; | 558 | using (Stream s = fwdrsp.GetResponseStream()) |
559 | fwdresponsecode = (int)fwdrsp.StatusCode; | 559 | { |
560 | fwdresponsestream.Close(); | 560 | using (StreamReader fwdresponsestream = new StreamReader(s)) |
561 | { | ||
562 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | ||
563 | fwdresponsecontenttype = fwdrsp.ContentType; | ||
564 | fwdresponsecode = (int)fwdrsp.StatusCode; | ||
565 | } | ||
566 | } | ||
567 | } | ||
561 | 568 | ||
562 | response["content_type"] = fwdresponsecontenttype; | 569 | response["content_type"] = fwdresponsecontenttype; |
563 | response["str_response_string"] = fwdresponsestr; | 570 | response["str_response_string"] = fwdresponsestr; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 881807a..cb69411 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -1116,18 +1116,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1116 | // Otherwise prepare the request | 1116 | // Otherwise prepare the request |
1117 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); | 1117 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); |
1118 | 1118 | ||
1119 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); | 1119 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); |
1120 | HttpWebResponse rsp = null; | ||
1121 | 1120 | ||
1122 | // We are sending just parameters, no content | 1121 | // We are sending just parameters, no content |
1123 | req.ContentLength = 0; | 1122 | req.ContentLength = 0; |
1124 | 1123 | ||
1125 | // Send request and retrieve the response | 1124 | // Send request and retrieve the response |
1126 | rsp = (HttpWebResponse)req.GetResponse(); | 1125 | using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) |
1127 | 1126 | using (Stream s = rsp.GetResponseStream()) | |
1128 | XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); | 1127 | using (XmlTextReader rdr = new XmlTextReader(s)) |
1129 | doc.Load(rdr); | 1128 | doc.Load(rdr); |
1130 | rdr.Close(); | ||
1131 | } | 1129 | } |
1132 | catch (Exception e) | 1130 | catch (Exception e) |
1133 | { | 1131 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1101851..71b24ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -1146,28 +1146,38 @@ namespace Nwc.XmlRpc | |||
1146 | request.AllowWriteStreamBuffering = true; | 1146 | request.AllowWriteStreamBuffering = true; |
1147 | request.KeepAlive = !_disableKeepAlive; | 1147 | request.KeepAlive = !_disableKeepAlive; |
1148 | 1148 | ||
1149 | Stream stream = request.GetRequestStream(); | 1149 | using (Stream stream = request.GetRequestStream()) |
1150 | XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); | ||
1151 | _serializer.Serialize(xml, this); | ||
1152 | xml.Flush(); | ||
1153 | xml.Close(); | ||
1154 | |||
1155 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
1156 | StreamReader input = new StreamReader(response.GetResponseStream()); | ||
1157 | |||
1158 | string inputXml = input.ReadToEnd(); | ||
1159 | XmlRpcResponse resp; | ||
1160 | try | ||
1161 | { | 1150 | { |
1162 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | 1151 | using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII)) |
1152 | { | ||
1153 | _serializer.Serialize(xml, this); | ||
1154 | xml.Flush(); | ||
1155 | } | ||
1163 | } | 1156 | } |
1164 | catch (Exception e) | 1157 | |
1158 | XmlRpcResponse resp; | ||
1159 | |||
1160 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) | ||
1165 | { | 1161 | { |
1166 | RequestResponse = inputXml; | 1162 | using (Stream s = response.GetResponseStream()) |
1167 | throw e; | 1163 | { |
1164 | using (StreamReader input = new StreamReader(s)) | ||
1165 | { | ||
1166 | string inputXml = input.ReadToEnd(); | ||
1167 | |||
1168 | try | ||
1169 | { | ||
1170 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | ||
1171 | } | ||
1172 | catch (Exception e) | ||
1173 | { | ||
1174 | RequestResponse = inputXml; | ||
1175 | throw e; | ||
1176 | } | ||
1177 | } | ||
1178 | } | ||
1168 | } | 1179 | } |
1169 | input.Close(); | 1180 | |
1170 | response.Close(); | ||
1171 | return resp; | 1181 | return resp; |
1172 | } | 1182 | } |
1173 | } | 1183 | } |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs index 7d37135..ad2fc7a 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe95..bb9cbb7 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 1f186c3..f442ca2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -204,7 +204,7 @@ public sealed class BSCharacter : BSPhysObject | |||
204 | // move. Thus, the velocity cannot be forced to zero. The problem is that small velocity | 204 | // move. Thus, the velocity cannot be forced to zero. The problem is that small velocity |
205 | // errors can creap in and the avatar will slowly float off in some direction. | 205 | // errors can creap in and the avatar will slowly float off in some direction. |
206 | // So, the problem is that, when an avatar is standing, we cannot tell creaping error | 206 | // So, the problem is that, when an avatar is standing, we cannot tell creaping error |
207 | // from real pushing.OMV.Vector3.Zero; | 207 | // from real pushing. |
208 | // The code below keeps setting the velocity to zero hoping the world will keep pushing. | 208 | // The code below keeps setting the velocity to zero hoping the world will keep pushing. |
209 | 209 | ||
210 | _velocityMotor.Step(timeStep); | 210 | _velocityMotor.Step(timeStep); |
@@ -254,9 +254,11 @@ public sealed class BSCharacter : BSPhysObject | |||
254 | } | 254 | } |
255 | 255 | ||
256 | // If falling, we keep the world's downward vector no matter what the other axis specify. | 256 | // If falling, we keep the world's downward vector no matter what the other axis specify. |
257 | // The check for _velocity.Z < 0 makes jumping work (temporary upward force). | ||
257 | if (!Flying && !IsColliding) | 258 | if (!Flying && !IsColliding) |
258 | { | 259 | { |
259 | stepVelocity.Z = _velocity.Z; | 260 | if (_velocity.Z < 0) |
261 | stepVelocity.Z = _velocity.Z; | ||
260 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); | 262 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); |
261 | } | 263 | } |
262 | 264 | ||
@@ -512,7 +514,7 @@ public sealed class BSCharacter : BSPhysObject | |||
512 | // just assign to "Position" because of potential call loops. | 514 | // just assign to "Position" because of potential call loops. |
513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() | 515 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
514 | { | 516 | { |
515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 517 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
516 | ForcePosition = _position; | 518 | ForcePosition = _position; |
517 | }); | 519 | }); |
518 | ret = true; | 520 | ret = true; |
@@ -572,7 +574,7 @@ public sealed class BSCharacter : BSPhysObject | |||
572 | m_targetVelocity = value; | 574 | m_targetVelocity = value; |
573 | OMV.Vector3 targetVel = value; | 575 | OMV.Vector3 targetVel = value; |
574 | if (_setAlwaysRun) | 576 | if (_setAlwaysRun) |
575 | targetVel *= BSParam.AvatarAlwaysRunFactor; | 577 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); |
576 | 578 | ||
577 | PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate() | 579 | PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate() |
578 | { | 580 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4dff927..8f660c4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -470,7 +470,7 @@ public class BSPrim : BSPhysObject | |||
470 | // Note that this does not change _mass! | 470 | // Note that this does not change _mass! |
471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) | 471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
472 | { | 472 | { |
473 | if (PhysBody.HasPhysicalBody) | 473 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) |
474 | { | 474 | { |
475 | if (IsStatic) | 475 | if (IsStatic) |
476 | { | 476 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 49718c4..4dc16f4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,5 +1,12 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
4 | Speed up hullifying large meshes. | ||
5 | Enable vehicle border crossings (at least as poorly as ODE) | ||
6 | Terrain skirts | ||
7 | Avatar created in previous region and not new region when crossing border | ||
8 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
9 | Lock axis | ||
3 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 10 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
4 | Not sure if it is because standing on it. Done with large prim linksets. | 11 | Not sure if it is because standing on it. Done with large prim linksets. |
5 | Vehicle angular vertical attraction | 12 | Vehicle angular vertical attraction |
@@ -7,16 +14,11 @@ vehicle angular banking | |||
7 | Center-of-gravity | 14 | Center-of-gravity |
8 | Vehicle angular deflection | 15 | Vehicle angular deflection |
9 | Preferred orientation angular correction fix | 16 | Preferred orientation angular correction fix |
10 | Enable vehicle border crossings (at least as poorly as ODE) | ||
11 | Terrain skirts | ||
12 | Avatar created in previous region and not new region when crossing border | ||
13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
14 | when should angular and linear motor targets be zeroed? when selected? | 17 | when should angular and linear motor targets be zeroed? when selected? |
15 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | 18 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. |
16 | Teravus llMoveToTarget script debug | 19 | Teravus llMoveToTarget script debug |
17 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force | 20 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force |
18 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) | 21 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) |
19 | Nebadon vehicles turning funny in arena | ||
20 | limitMotorUp calibration (more down?) | 22 | limitMotorUp calibration (more down?) |
21 | llRotLookAt | 23 | llRotLookAt |
22 | llLookAt | 24 | llLookAt |
@@ -66,6 +68,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation | |||
66 | 68 | ||
67 | GENERAL TODO LIST: | 69 | GENERAL TODO LIST: |
68 | ================================================= | 70 | ================================================= |
71 | Resitution of a prim works on another prim but not on terrain. | ||
72 | The dropped prim doesn't bounce properly on the terrain. | ||
69 | Add a sanity check for PIDTarget location. | 73 | Add a sanity check for PIDTarget location. |
70 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. | 74 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. |
71 | Is much saved with lower LODs? At the moment, all set to 32. | 75 | Is much saved with lower LODs? At the moment, all set to 32. |
@@ -163,7 +167,6 @@ Create tests for different interface components | |||
163 | Have test objects/scripts measure themselves and turn color if correct/bad | 167 | Have test objects/scripts measure themselves and turn color if correct/bad |
164 | Test functions in SL and calibrate correctness there | 168 | Test functions in SL and calibrate correctness there |
165 | Create auto rezzer and tracker to run through the tests | 169 | Create auto rezzer and tracker to run through the tests |
166 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
167 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? | 170 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? |
168 | There is some problem with meshes and collisions | 171 | There is some problem with meshes and collisions |
169 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. | 172 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. |
@@ -334,4 +337,5 @@ Child movement in linkset (don't rebuild linkset) (DONE 20130122)) | |||
334 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) | 337 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) |
335 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | 338 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. |
336 | Verify that angular motion specified around Z moves in the vehicle coordinates. | 339 | Verify that angular motion specified around Z moves in the vehicle coordinates. |
337 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file | 340 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. |
341 | Nebadon vehicles turning funny in arena (DONE) \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 96f650e..6a31568 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9423,6 +9423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9423 | return UUID.Zero.ToString(); | 9423 | return UUID.Zero.ToString(); |
9424 | } | 9424 | } |
9425 | } | 9425 | } |
9426 | |||
9426 | public LSL_String llRequestURL() | 9427 | public LSL_String llRequestURL() |
9427 | { | 9428 | { |
9428 | m_host.AddScriptLPS(1); | 9429 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs index 7ea30bf1..ac822c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs | |||
@@ -443,7 +443,6 @@ default | |||
443 | string itemName = "TestNoStop"; | 443 | string itemName = "TestNoStop"; |
444 | 444 | ||
445 | SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId); | 445 | SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId); |
446 | TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName); | ||
447 | 446 | ||
448 | // Wait for the script to start the event before we try stopping it. | 447 | // Wait for the script to start the event before we try stopping it. |
449 | m_chatEvent.WaitOne(60000); | 448 | m_chatEvent.WaitOne(60000); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs new file mode 100644 index 0000000..b0baa1c --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Region.CoreModules.Scripting.LSLHttp; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.ScriptEngine.Shared; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | using OpenSim.Tests.Common; | ||
48 | using OpenSim.Tests.Common.Mock; | ||
49 | |||
50 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// Tests for HTTP related functions in LSL | ||
54 | /// </summary> | ||
55 | [TestFixture] | ||
56 | public class LSL_ApiHttpTests : OpenSimTestCase | ||
57 | { | ||
58 | private Scene m_scene; | ||
59 | private MockScriptEngine m_engine; | ||
60 | private UrlModule m_urlModule; | ||
61 | |||
62 | private TaskInventoryItem m_scriptItem; | ||
63 | private LSL_Api m_lslApi; | ||
64 | |||
65 | [TestFixtureSetUp] | ||
66 | public void TestFixtureSetUp() | ||
67 | { | ||
68 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
69 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
70 | } | ||
71 | |||
72 | [TestFixtureTearDown] | ||
73 | public void TestFixureTearDown() | ||
74 | { | ||
75 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
76 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
77 | // tests really shouldn't). | ||
78 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
79 | } | ||
80 | |||
81 | [SetUp] | ||
82 | public override void SetUp() | ||
83 | { | ||
84 | base.SetUp(); | ||
85 | |||
86 | // This is an unfortunate bit of clean up we have to do because MainServer manages things through static | ||
87 | // variables and the VM is not restarted between tests. | ||
88 | uint port = 9999; | ||
89 | MainServer.RemoveHttpServer(port); | ||
90 | |||
91 | BaseHttpServer server = new BaseHttpServer(port, false, 0, ""); | ||
92 | MainServer.AddHttpServer(server); | ||
93 | MainServer.Instance = server; | ||
94 | |||
95 | server.Start(); | ||
96 | |||
97 | m_engine = new MockScriptEngine(); | ||
98 | m_urlModule = new UrlModule(); | ||
99 | |||
100 | m_scene = new SceneHelpers().SetupScene(); | ||
101 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); | ||
102 | |||
103 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
104 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); | ||
105 | |||
106 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. | ||
107 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. | ||
108 | m_lslApi = new LSL_Api(); | ||
109 | m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null); | ||
110 | } | ||
111 | |||
112 | [TearDown] | ||
113 | public void TearDown() | ||
114 | { | ||
115 | MainServer.Instance.Stop(); | ||
116 | } | ||
117 | |||
118 | [Test] | ||
119 | public void TestLlReleaseUrl() | ||
120 | { | ||
121 | TestHelpers.InMethod(); | ||
122 | |||
123 | m_lslApi.llRequestURL(); | ||
124 | string returnedUri = m_engine.PostedEvents[m_scriptItem.ItemID][0].Params[2].ToString(); | ||
125 | |||
126 | { | ||
127 | // Check that the initial number of URLs is correct | ||
128 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
129 | } | ||
130 | |||
131 | { | ||
132 | // Check releasing a non-url | ||
133 | m_lslApi.llReleaseURL("GARBAGE"); | ||
134 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
135 | } | ||
136 | |||
137 | { | ||
138 | // Check releasing a non-existing url | ||
139 | m_lslApi.llReleaseURL("http://example.com"); | ||
140 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
141 | } | ||
142 | |||
143 | { | ||
144 | // Check URL release | ||
145 | m_lslApi.llReleaseURL(returnedUri); | ||
146 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
147 | |||
148 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
149 | |||
150 | bool gotExpectedException = false; | ||
151 | |||
152 | try | ||
153 | { | ||
154 | using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
155 | {} | ||
156 | } | ||
157 | catch (WebException e) | ||
158 | { | ||
159 | using (HttpWebResponse response = (HttpWebResponse)e.Response) | ||
160 | gotExpectedException = response.StatusCode == HttpStatusCode.NotFound; | ||
161 | } | ||
162 | |||
163 | Assert.That(gotExpectedException, Is.True); | ||
164 | } | ||
165 | |||
166 | { | ||
167 | // Check releasing the same URL again | ||
168 | m_lslApi.llReleaseURL(returnedUri); | ||
169 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | [Test] | ||
174 | public void TestLlRequestUrl() | ||
175 | { | ||
176 | TestHelpers.InMethod(); | ||
177 | |||
178 | string requestId = m_lslApi.llRequestURL(); | ||
179 | Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString())); | ||
180 | string returnedUri; | ||
181 | |||
182 | { | ||
183 | // Check that URL is correctly set up | ||
184 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
185 | |||
186 | Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
187 | |||
188 | List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
189 | Assert.That(events.Count, Is.EqualTo(1)); | ||
190 | EventParams eventParams = events[0]; | ||
191 | Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
192 | |||
193 | UUID returnKey; | ||
194 | string rawReturnKey = eventParams.Params[0].ToString(); | ||
195 | string method = eventParams.Params[1].ToString(); | ||
196 | returnedUri = eventParams.Params[2].ToString(); | ||
197 | |||
198 | Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
199 | Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED)); | ||
200 | Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True); | ||
201 | } | ||
202 | |||
203 | { | ||
204 | // Check that request to URL works. | ||
205 | string testResponse = "Hello World"; | ||
206 | |||
207 | m_engine.ClearPostedEvents(); | ||
208 | m_engine.PostEventHook | ||
209 | += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); | ||
210 | |||
211 | // Console.WriteLine("Trying {0}", returnedUri); | ||
212 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
213 | |||
214 | AssertHttpResponse(returnedUri, testResponse); | ||
215 | |||
216 | Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
217 | |||
218 | List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
219 | Assert.That(events.Count, Is.EqualTo(1)); | ||
220 | EventParams eventParams = events[0]; | ||
221 | Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
222 | |||
223 | UUID returnKey; | ||
224 | string rawReturnKey = eventParams.Params[0].ToString(); | ||
225 | string method = eventParams.Params[1].ToString(); | ||
226 | string body = eventParams.Params[2].ToString(); | ||
227 | |||
228 | Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
229 | Assert.That(method, Is.EqualTo("GET")); | ||
230 | Assert.That(body, Is.EqualTo("")); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | private void AssertHttpResponse(string uri, string expectedResponse) | ||
235 | { | ||
236 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri); | ||
237 | |||
238 | using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
239 | { | ||
240 | using (Stream stream = webResponse.GetResponseStream()) | ||
241 | { | ||
242 | using (StreamReader reader = new StreamReader(stream)) | ||
243 | { | ||
244 | Assert.That(reader.ReadToEnd(), Is.EqualTo(expectedResponse)); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 1f8a6e5..74f010e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -222,7 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
222 | // Store an avatar with a different height from default in a notecard. | 222 | // Store an avatar with a different height from default in a notecard. |
223 | UUID userId = TestHelpers.ParseTail(0x1); | 223 | UUID userId = TestHelpers.ParseTail(0x1); |
224 | float firstHeight = 1.9f; | 224 | float firstHeight = 1.9f; |
225 | float secondHeight = 2.1f; | 225 | // float secondHeight = 2.1f; |
226 | string firstAppearanceNcName = "appearanceNc1"; | 226 | string firstAppearanceNcName = "appearanceNc1"; |
227 | string secondAppearanceNcName = "appearanceNc2"; | 227 | string secondAppearanceNcName = "appearanceNc2"; |
228 | 228 | ||