Patch #9140 (Mantis #1683)

Add LifetimeService overrides to all MarshalByRef derived classes
to prevent the remoting interfaces from expiring.
0.6.0-stable
Melanie Thielker 2008-07-11 17:52:39 +00:00
parent 3646cc32c4
commit 53461fad2c
2 changed files with 28 additions and 0 deletions

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.Runtime.Remoting.Lifetime;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using Nini.Config; using Nini.Config;
@ -55,6 +56,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_itemID = itemID; 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 // OpenSim functions

View File

@ -40,6 +40,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
private Dictionary<string,MethodInfo> inits = new Dictionary<string,MethodInfo>(); private Dictionary<string,MethodInfo> inits = new Dictionary<string,MethodInfo>();
//
// 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() public ScriptBaseClass()
{ {
MethodInfo[] myArrayMethodInfo = GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance); MethodInfo[] myArrayMethodInfo = GetType().GetMethods(BindingFlags.Public|BindingFlags.Instance);