From 53461fad2ce4f191404abb9f26e41cb3217daa66 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 11 Jul 2008 17:52:39 +0000 Subject: [PATCH] Patch #9140 (Mantis #1683) Add LifetimeService overrides to all MarshalByRef derived classes to prevent the remoting interfaces from expiring. --- .../Shared/Api/Implementation/OSSL_Api.cs | 14 ++++++++++++++ .../ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ae138b4d10..914aeac58a 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 c12b1f83b8..5b32cdef2d 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);