diff options
author | Justin Clark-Casey (justincc) | 2012-01-14 00:23:11 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-14 00:23:11 +0000 |
commit | b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f (patch) | |
tree | c4516b37b09c2a104019845ef167c262836487e9 /OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f.zip opensim-SC_OLD-b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f.tar.gz opensim-SC_OLD-b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f.tar.bz2 opensim-SC_OLD-b5bb559cc020df0b2e7d77a46f7d47a8fed1bc9f.tar.xz |
Register the UrlModule for script engine events OnScriptRemoved and OnObjectRemoved just once in the UrlModule itself, rather than repeatedly for every script.
Doing this in every script is unnecessary since the event trigger is parameterized by the item id.
All that would happen is 2000 scripts would trigger 1999 unnecessary calls, and a large number of initialized scripts may eventually trigger a StackOverflowException.
Registration moved to UrlModule so that the handler is registered for all script engine implementations.
This required moving the OnScriptRemoved and OnObjectRemoved events (only used by UrlModule in core) from IScriptEngine to IScriptModule to avoid circular references.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 67d99e0..93e75b3 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
131 | 131 | ||
132 | public void RegionLoaded(Scene scene) | 132 | public void RegionLoaded(Scene scene) |
133 | { | 133 | { |
134 | IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>(); | ||
135 | foreach (IScriptModule scriptModule in scriptModules) | ||
136 | { | ||
137 | scriptModule.OnScriptRemoved += ScriptRemoved; | ||
138 | scriptModule.OnObjectRemoved += ObjectRemoved; | ||
139 | } | ||
134 | } | 140 | } |
135 | 141 | ||
136 | public void RemoveRegion(Scene scene) | 142 | public void RemoveRegion(Scene scene) |
@@ -160,7 +166,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
160 | urlData.url = url; | 166 | urlData.url = url; |
161 | urlData.urlcode = urlcode; | 167 | urlData.urlcode = urlcode; |
162 | urlData.requests = new Dictionary<UUID, RequestData>(); | 168 | urlData.requests = new Dictionary<UUID, RequestData>(); |
163 | |||
164 | 169 | ||
165 | m_UrlMap[url] = urlData; | 170 | m_UrlMap[url] = urlData; |
166 | 171 | ||
@@ -276,6 +281,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
276 | 281 | ||
277 | public void ScriptRemoved(UUID itemID) | 282 | public void ScriptRemoved(UUID itemID) |
278 | { | 283 | { |
284 | // m_log.DebugFormat("[URL MODULE]: Removing script {0}", itemID); | ||
285 | |||
279 | lock (m_UrlMap) | 286 | lock (m_UrlMap) |
280 | { | 287 | { |
281 | List<string> removeURLs = new List<string>(); | 288 | List<string> removeURLs = new List<string>(); |