diff options
author | Tedd Hansen | 2008-11-26 11:12:57 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-11-26 11:12:57 +0000 |
commit | e6ddb5de7de4ed61fa19b3805cd77104328eb20a (patch) | |
tree | 37c975b8d660174d96c05830daf7aab92eaf2309 /OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |
parent | Comment one more field that can't be tested that way anymore (diff) | |
download | opensim-SC-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.zip opensim-SC-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.gz opensim-SC-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.bz2 opensim-SC-e6ddb5de7de4ed61fa19b3805cd77104328eb20a.tar.xz |
Attempt to give script objects a proper lease time (DNE and xengine). Relies on GC. Also removed lease for LSL_Api as it strictly speaking should not be MarshalByRef. Or should it? If so I broke scripting! :)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index bd60759..b5cbd25 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Globalization; | 30 | using System.Globalization; |
31 | using System.Runtime.Remoting; | ||
32 | using System.Runtime.Remoting.Lifetime; | ||
31 | using log4net; | 33 | using log4net; |
32 | using OpenMetaverse; | 34 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -39,6 +41,7 @@ using System.Collections.Generic; | |||
39 | using System.IO; | 41 | using System.IO; |
40 | using System.Runtime.Serialization.Formatters.Binary; | 42 | using System.Runtime.Serialization.Formatters.Binary; |
41 | using System.Threading; | 43 | using System.Threading; |
44 | using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; | ||
42 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
43 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 46 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
44 | 47 | ||
@@ -56,6 +59,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
56 | public Dictionary<string, IScriptApi> Apis; | 59 | public Dictionary<string, IScriptApi> Apis; |
57 | public Dictionary<KeyValuePair<int,int>, KeyValuePair<int,int>> | 60 | public Dictionary<KeyValuePair<int,int>, KeyValuePair<int,int>> |
58 | LineMap; | 61 | LineMap; |
62 | public ISponsor ScriptSponsor; | ||
59 | } | 63 | } |
60 | 64 | ||
61 | public class ScriptManager | 65 | public class ScriptManager |
@@ -164,6 +168,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
164 | CompiledScript = | 168 | CompiledScript = |
165 | m_scriptEngine.m_AppDomainManager.LoadScript( | 169 | m_scriptEngine.m_AppDomainManager.LoadScript( |
166 | CompiledScriptFile, out id.AppDomain); | 170 | CompiledScriptFile, out id.AppDomain); |
171 | //Register the sponsor | ||
172 | ISponsor scriptSponsor = new ScriptSponsor(); | ||
173 | ILease lease = (ILease)RemotingServices.GetLifetimeService(CompiledScript as MarshalByRefObject); | ||
174 | lease.Register(scriptSponsor); | ||
175 | id.ScriptSponsor = scriptSponsor; | ||
167 | 176 | ||
168 | id.LineMap = LSLCompiler.LineMap(); | 177 | id.LineMap = LSLCompiler.LineMap(); |
169 | id.Script = CompiledScript; | 178 | id.Script = CompiledScript; |