From 53461fad2ce4f191404abb9f26e41cb3217daa66 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 11 Jul 2008 17:52:39 +0000 Subject: Patch #9140 (Mantis #1683) Add LifetimeService overrides to all MarshalByRef derived classes to prevent the remoting interfaces from expiring. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 ++++++++++++++ .../Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 14 ++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ae138b4..914aeac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; +using System.Runtime.Remoting.Lifetime; using Axiom.Math; using libsecondlife; using Nini.Config; @@ -55,6 +56,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_itemID = itemID; } + // + // Never expire this object + // + public override Object InitializeLifetimeService() + { + ILease lease = (ILease)base.InitializeLifetimeService(); + + if (lease.CurrentState == LeaseState.Initial) + { + lease.InitialLeaseTime = TimeSpan.Zero; + } + return lease; + } // // OpenSim functions diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index c12b1f8..5b32cde 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs @@ -40,6 +40,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { private Dictionary inits = new Dictionary(); + // + // Never expire this object + // + public override Object InitializeLifetimeService() + { + ILease lease = (ILease)base.InitializeLifetimeService(); + + if (lease.CurrentState == LeaseState.Initial) + { + lease.InitialLeaseTime = TimeSpan.Zero; + } + return lease; + } + public ScriptBaseClass() { MethodInfo[] myArrayMethodInfo = GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance); -- cgit v1.1