This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,139 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Lifetime
{
/// <summary>Provides a default implementation for a lifetime sponsor class.</summary>
// Token: 0x020003CE RID: 974
[ComVisible(true)]
public class ClientSponsor : MarshalByRefObject, ISponsor
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" /> class with default values.</summary>
// Token: 0x06002652 RID: 9810 RVA: 0x0007E610 File Offset: 0x0007C810
public ClientSponsor()
{
this.renewal_time = new TimeSpan(0, 2, 0);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" /> class with the renewal time of the sponsored object.</summary>
/// <param name="renewalTime">The <see cref="T:System.TimeSpan" /> by which to increase the lifetime of the sponsored objects when renewal is requested. </param>
// Token: 0x06002653 RID: 9811 RVA: 0x0007E634 File Offset: 0x0007C834
public ClientSponsor(TimeSpan renewalTime)
{
this.renewal_time = renewalTime;
}
/// <summary>Gets or sets the <see cref="T:System.TimeSpan" /> by which to increase the lifetime of the sponsored objects when renewal is requested.</summary>
/// <returns>The <see cref="T:System.TimeSpan" /> by which to increase the lifetime of the sponsored objects when renewal is requested.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072A RID: 1834
// (get) Token: 0x06002654 RID: 9812 RVA: 0x0007E650 File Offset: 0x0007C850
// (set) Token: 0x06002655 RID: 9813 RVA: 0x0007E658 File Offset: 0x0007C858
public TimeSpan RenewalTime
{
get
{
return this.renewal_time;
}
set
{
this.renewal_time = value;
}
}
/// <summary>Empties the list objects registered with the current <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" />.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002656 RID: 9814 RVA: 0x0007E664 File Offset: 0x0007C864
public void Close()
{
foreach (object obj in this.registered_objects.Values)
{
MarshalByRefObject marshalByRefObject = (MarshalByRefObject)obj;
ILease lease = marshalByRefObject.GetLifetimeService() as ILease;
lease.Unregister(this);
}
this.registered_objects.Clear();
}
/// <summary>Frees the resources of the current <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" /> before the garbage collector reclaims them.</summary>
// Token: 0x06002657 RID: 9815 RVA: 0x0007E6F0 File Offset: 0x0007C8F0
~ClientSponsor()
{
this.Close();
}
/// <summary>Initializes a new instance of <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" />, providing a lease for the current object.</summary>
/// <returns>An <see cref="T:System.Runtime.Remoting.Lifetime.ILease" /> for the current object.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002658 RID: 9816 RVA: 0x0007E72C File Offset: 0x0007C92C
public override object InitializeLifetimeService()
{
return base.InitializeLifetimeService();
}
/// <summary>Registers the specified <see cref="T:System.MarshalByRefObject" /> for sponsorship.</summary>
/// <returns>true if registration succeeded; otherwise, false.</returns>
/// <param name="obj">The object to register for sponsorship with the <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" />. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure" />
/// </PermissionSet>
// Token: 0x06002659 RID: 9817 RVA: 0x0007E734 File Offset: 0x0007C934
public bool Register(MarshalByRefObject obj)
{
if (this.registered_objects.ContainsKey(obj))
{
return false;
}
ILease lease = obj.GetLifetimeService() as ILease;
if (lease == null)
{
return false;
}
lease.Register(this);
this.registered_objects.Add(obj, obj);
return true;
}
/// <summary>Requests a sponsoring client to renew the lease for the specified object.</summary>
/// <returns>The additional lease time for the specified object.</returns>
/// <param name="lease">The lifetime lease of the object that requires lease renewal. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600265A RID: 9818 RVA: 0x0007E780 File Offset: 0x0007C980
public TimeSpan Renewal(ILease lease)
{
return this.renewal_time;
}
/// <summary>Unregisters the specified <see cref="T:System.MarshalByRefObject" /> from the list of objects sponsored by the current <see cref="T:System.Runtime.Remoting.Lifetime.ClientSponsor" />.</summary>
/// <param name="obj">The object to unregister. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600265B RID: 9819 RVA: 0x0007E788 File Offset: 0x0007C988
public void Unregister(MarshalByRefObject obj)
{
if (!this.registered_objects.ContainsKey(obj))
{
return;
}
ILease lease = obj.GetLifetimeService() as ILease;
lease.Unregister(this);
this.registered_objects.Remove(obj);
}
// Token: 0x04000EF3 RID: 3827
private TimeSpan renewal_time;
// Token: 0x04000EF4 RID: 3828
private Hashtable registered_objects = new Hashtable();
}
}
@@ -0,0 +1,99 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Lifetime
{
/// <summary>Defines a lifetime lease object that is used by the remoting lifetime service.</summary>
// Token: 0x020003CF RID: 975
[ComVisible(true)]
public interface ILease
{
/// <summary>Gets the amount of time remaining on the lease.</summary>
/// <returns>The amount of time remaining on the lease.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072B RID: 1835
// (get) Token: 0x0600265C RID: 9820
TimeSpan CurrentLeaseTime { get; }
/// <summary>Gets the current <see cref="T:System.Runtime.Remoting.Lifetime.LeaseState" /> of the lease.</summary>
/// <returns>The current <see cref="T:System.Runtime.Remoting.Lifetime.LeaseState" /> of the lease.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072C RID: 1836
// (get) Token: 0x0600265D RID: 9821
LeaseState CurrentState { get; }
/// <summary>Gets or sets the initial time for the lease.</summary>
/// <returns>The initial time for the lease.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072D RID: 1837
// (get) Token: 0x0600265E RID: 9822
// (set) Token: 0x0600265F RID: 9823
TimeSpan InitialLeaseTime { get; set; }
/// <summary>Gets or sets the amount of time by which a call to the remote object renews the <see cref="P:System.Runtime.Remoting.Lifetime.ILease.CurrentLeaseTime" />.</summary>
/// <returns>The amount of time by which a call to the remote object renews the <see cref="P:System.Runtime.Remoting.Lifetime.ILease.CurrentLeaseTime" />.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072E RID: 1838
// (get) Token: 0x06002660 RID: 9824
// (set) Token: 0x06002661 RID: 9825
TimeSpan RenewOnCallTime { get; set; }
/// <summary>Gets or sets the amount of time to wait for a sponsor to return with a lease renewal time.</summary>
/// <returns>The amount of time to wait for a sponsor to return with a lease renewal time.</returns>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700072F RID: 1839
// (get) Token: 0x06002662 RID: 9826
// (set) Token: 0x06002663 RID: 9827
TimeSpan SponsorshipTimeout { get; set; }
/// <summary>Registers a sponsor for the lease without renewing the lease.</summary>
/// <param name="obj">The callback object of the sponsor. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002664 RID: 9828
void Register(ISponsor obj);
/// <summary>Registers a sponsor for the lease, and renews it by the specified <see cref="T:System.TimeSpan" />.</summary>
/// <param name="obj">The callback object of the sponsor. </param>
/// <param name="renewalTime">The length of time to renew the lease by. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
// Token: 0x06002665 RID: 9829
void Register(ISponsor obj, TimeSpan renewalTime);
/// <summary>Renews a lease for the specified time.</summary>
/// <returns>The new expiration time of the lease.</returns>
/// <param name="renewalTime">The length of time to renew the lease by. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002666 RID: 9830
TimeSpan Renew(TimeSpan renewalTime);
/// <summary>Removes a sponsor from the sponsor list.</summary>
/// <param name="obj">The lease sponsor to unregister. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002667 RID: 9831
void Unregister(ISponsor obj);
}
}
@@ -0,0 +1,21 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Lifetime
{
/// <summary>Indicates that the implementer wants to be a lifetime lease sponsor.</summary>
// Token: 0x020003D0 RID: 976
[ComVisible(true)]
public interface ISponsor
{
/// <summary>Requests a sponsoring client to renew the lease for the specified object.</summary>
/// <returns>The additional lease time for the specified object.</returns>
/// <param name="lease">The lifetime lease of the object that requires lease renewal. </param>
/// <exception cref="T:System.Security.SecurityException">The immediate caller makes the call through a reference to the interface and does not have infrastructure permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002668 RID: 9832
TimeSpan Renewal(ILease lease);
}
}
@@ -0,0 +1,255 @@
using System;
using System.Collections;
using System.Threading;
namespace System.Runtime.Remoting.Lifetime
{
// Token: 0x020003D1 RID: 977
internal class Lease : MarshalByRefObject, ILease
{
// Token: 0x06002669 RID: 9833 RVA: 0x0007E7C8 File Offset: 0x0007C9C8
public Lease()
{
this._currentState = LeaseState.Initial;
this._initialLeaseTime = LifetimeServices.LeaseTime;
this._renewOnCallTime = LifetimeServices.RenewOnCallTime;
this._sponsorshipTimeout = LifetimeServices.SponsorshipTimeout;
this._leaseExpireTime = DateTime.Now + this._initialLeaseTime;
}
// Token: 0x17000730 RID: 1840
// (get) Token: 0x0600266A RID: 9834 RVA: 0x0007E81C File Offset: 0x0007CA1C
public TimeSpan CurrentLeaseTime
{
get
{
return this._leaseExpireTime - DateTime.Now;
}
}
// Token: 0x17000731 RID: 1841
// (get) Token: 0x0600266B RID: 9835 RVA: 0x0007E830 File Offset: 0x0007CA30
public LeaseState CurrentState
{
get
{
return this._currentState;
}
}
// Token: 0x0600266C RID: 9836 RVA: 0x0007E838 File Offset: 0x0007CA38
public void Activate()
{
this._currentState = LeaseState.Active;
}
// Token: 0x17000732 RID: 1842
// (get) Token: 0x0600266D RID: 9837 RVA: 0x0007E844 File Offset: 0x0007CA44
// (set) Token: 0x0600266E RID: 9838 RVA: 0x0007E84C File Offset: 0x0007CA4C
public TimeSpan InitialLeaseTime
{
get
{
return this._initialLeaseTime;
}
set
{
if (this._currentState != LeaseState.Initial)
{
throw new RemotingException("InitialLeaseTime property can only be set when the lease is in initial state; state is " + this._currentState + ".");
}
this._initialLeaseTime = value;
this._leaseExpireTime = DateTime.Now + this._initialLeaseTime;
if (value == TimeSpan.Zero)
{
this._currentState = LeaseState.Null;
}
}
}
// Token: 0x17000733 RID: 1843
// (get) Token: 0x0600266F RID: 9839 RVA: 0x0007E8BC File Offset: 0x0007CABC
// (set) Token: 0x06002670 RID: 9840 RVA: 0x0007E8C4 File Offset: 0x0007CAC4
public TimeSpan RenewOnCallTime
{
get
{
return this._renewOnCallTime;
}
set
{
if (this._currentState != LeaseState.Initial)
{
throw new RemotingException("RenewOnCallTime property can only be set when the lease is in initial state; state is " + this._currentState + ".");
}
this._renewOnCallTime = value;
}
}
// Token: 0x17000734 RID: 1844
// (get) Token: 0x06002671 RID: 9841 RVA: 0x0007E8FC File Offset: 0x0007CAFC
// (set) Token: 0x06002672 RID: 9842 RVA: 0x0007E904 File Offset: 0x0007CB04
public TimeSpan SponsorshipTimeout
{
get
{
return this._sponsorshipTimeout;
}
set
{
if (this._currentState != LeaseState.Initial)
{
throw new RemotingException("SponsorshipTimeout property can only be set when the lease is in initial state; state is " + this._currentState + ".");
}
this._sponsorshipTimeout = value;
}
}
// Token: 0x06002673 RID: 9843 RVA: 0x0007E93C File Offset: 0x0007CB3C
public void Register(ISponsor obj)
{
this.Register(obj, TimeSpan.Zero);
}
// Token: 0x06002674 RID: 9844 RVA: 0x0007E94C File Offset: 0x0007CB4C
public void Register(ISponsor obj, TimeSpan renewalTime)
{
lock (this)
{
if (this._sponsors == null)
{
this._sponsors = new ArrayList();
}
this._sponsors.Add(obj);
}
if (renewalTime != TimeSpan.Zero)
{
this.Renew(renewalTime);
}
}
// Token: 0x06002675 RID: 9845 RVA: 0x0007E9C4 File Offset: 0x0007CBC4
public TimeSpan Renew(TimeSpan renewalTime)
{
DateTime dateTime = DateTime.Now + renewalTime;
if (dateTime > this._leaseExpireTime)
{
this._leaseExpireTime = dateTime;
}
return this.CurrentLeaseTime;
}
// Token: 0x06002676 RID: 9846 RVA: 0x0007E9FC File Offset: 0x0007CBFC
public void Unregister(ISponsor obj)
{
lock (this)
{
if (this._sponsors != null)
{
for (int i = 0; i < this._sponsors.Count; i++)
{
if (object.ReferenceEquals(this._sponsors[i], obj))
{
this._sponsors.RemoveAt(i);
break;
}
}
}
}
}
// Token: 0x06002677 RID: 9847 RVA: 0x0007EA90 File Offset: 0x0007CC90
internal void UpdateState()
{
if (this._currentState != LeaseState.Active)
{
return;
}
if (this.CurrentLeaseTime > TimeSpan.Zero)
{
return;
}
if (this._sponsors != null)
{
this._currentState = LeaseState.Renewing;
lock (this)
{
this._renewingSponsors = new Queue(this._sponsors);
}
this.CheckNextSponsor();
}
else
{
this._currentState = LeaseState.Expired;
}
}
// Token: 0x06002678 RID: 9848 RVA: 0x0007EB28 File Offset: 0x0007CD28
private void CheckNextSponsor()
{
if (this._renewingSponsors.Count == 0)
{
this._currentState = LeaseState.Expired;
this._renewingSponsors = null;
return;
}
ISponsor sponsor = (ISponsor)this._renewingSponsors.Peek();
this._renewalDelegate = new Lease.RenewalDelegate(sponsor.Renewal);
IAsyncResult asyncResult = this._renewalDelegate.BeginInvoke(this, null, null);
ThreadPool.RegisterWaitForSingleObject(asyncResult.AsyncWaitHandle, new WaitOrTimerCallback(this.ProcessSponsorResponse), asyncResult, this._sponsorshipTimeout, true);
}
// Token: 0x06002679 RID: 9849 RVA: 0x0007EBA8 File Offset: 0x0007CDA8
private void ProcessSponsorResponse(object state, bool timedOut)
{
if (!timedOut)
{
try
{
IAsyncResult asyncResult = (IAsyncResult)state;
TimeSpan timeSpan = this._renewalDelegate.EndInvoke(asyncResult);
if (timeSpan != TimeSpan.Zero)
{
this.Renew(timeSpan);
this._currentState = LeaseState.Active;
this._renewingSponsors = null;
return;
}
}
catch
{
}
}
this.Unregister((ISponsor)this._renewingSponsors.Dequeue());
this.CheckNextSponsor();
}
// Token: 0x04000EF5 RID: 3829
private DateTime _leaseExpireTime;
// Token: 0x04000EF6 RID: 3830
private LeaseState _currentState;
// Token: 0x04000EF7 RID: 3831
private TimeSpan _initialLeaseTime;
// Token: 0x04000EF8 RID: 3832
private TimeSpan _renewOnCallTime;
// Token: 0x04000EF9 RID: 3833
private TimeSpan _sponsorshipTimeout;
// Token: 0x04000EFA RID: 3834
private ArrayList _sponsors;
// Token: 0x04000EFB RID: 3835
private Queue _renewingSponsors;
// Token: 0x04000EFC RID: 3836
private Lease.RenewalDelegate _renewalDelegate;
// Token: 0x020006CF RID: 1743
// (Invoke) Token: 0x060041C4 RID: 16836
private delegate TimeSpan RenewalDelegate(ILease lease);
}
}
@@ -0,0 +1,96 @@
using System;
using System.Collections;
using System.Threading;
namespace System.Runtime.Remoting.Lifetime
{
// Token: 0x020003D2 RID: 978
internal class LeaseManager
{
// Token: 0x0600267B RID: 9851 RVA: 0x0007EC54 File Offset: 0x0007CE54
public void SetPollTime(TimeSpan timeSpan)
{
object syncRoot = this._objects.SyncRoot;
lock (syncRoot)
{
if (this._timer != null)
{
this._timer.Change(timeSpan, timeSpan);
}
}
}
// Token: 0x0600267C RID: 9852 RVA: 0x0007ECB4 File Offset: 0x0007CEB4
public void TrackLifetime(ServerIdentity identity)
{
object syncRoot = this._objects.SyncRoot;
lock (syncRoot)
{
identity.Lease.Activate();
this._objects.Add(identity);
if (this._timer == null)
{
this.StartManager();
}
}
}
// Token: 0x0600267D RID: 9853 RVA: 0x0007ED24 File Offset: 0x0007CF24
public void StopTrackingLifetime(ServerIdentity identity)
{
object syncRoot = this._objects.SyncRoot;
lock (syncRoot)
{
this._objects.Remove(identity);
}
}
// Token: 0x0600267E RID: 9854 RVA: 0x0007ED78 File Offset: 0x0007CF78
public void StartManager()
{
this._timer = new Timer(new TimerCallback(this.ManageLeases), null, LifetimeServices.LeaseManagerPollTime, LifetimeServices.LeaseManagerPollTime);
}
// Token: 0x0600267F RID: 9855 RVA: 0x0007EDA8 File Offset: 0x0007CFA8
public void StopManager()
{
Timer timer = this._timer;
this._timer = null;
timer.Dispose();
}
// Token: 0x06002680 RID: 9856 RVA: 0x0007EDCC File Offset: 0x0007CFCC
public void ManageLeases(object state)
{
object syncRoot = this._objects.SyncRoot;
lock (syncRoot)
{
int i = 0;
while (i < this._objects.Count)
{
ServerIdentity serverIdentity = (ServerIdentity)this._objects[i];
serverIdentity.Lease.UpdateState();
if (serverIdentity.Lease.CurrentState == LeaseState.Expired)
{
this._objects.RemoveAt(i);
serverIdentity.OnLifetimeExpired();
}
else
{
i++;
}
}
if (this._objects.Count == 0)
{
this.StopManager();
}
}
}
// Token: 0x04000EFD RID: 3837
private ArrayList _objects = new ArrayList();
// Token: 0x04000EFE RID: 3838
private Timer _timer;
}
}
@@ -0,0 +1,53 @@
using System;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Lifetime
{
// Token: 0x020003D3 RID: 979
internal class LeaseSink : IMessageSink
{
// Token: 0x06002681 RID: 9857 RVA: 0x0007EE8C File Offset: 0x0007D08C
public LeaseSink(IMessageSink nextSink)
{
this._nextSink = nextSink;
}
// Token: 0x06002682 RID: 9858 RVA: 0x0007EE9C File Offset: 0x0007D09C
public IMessage SyncProcessMessage(IMessage msg)
{
this.RenewLease(msg);
return this._nextSink.SyncProcessMessage(msg);
}
// Token: 0x06002683 RID: 9859 RVA: 0x0007EEB4 File Offset: 0x0007D0B4
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
this.RenewLease(msg);
return this._nextSink.AsyncProcessMessage(msg, replySink);
}
// Token: 0x06002684 RID: 9860 RVA: 0x0007EECC File Offset: 0x0007D0CC
private void RenewLease(IMessage msg)
{
ServerIdentity serverIdentity = (ServerIdentity)RemotingServices.GetMessageTargetIdentity(msg);
ILease lease = serverIdentity.Lease;
if (lease != null && lease.CurrentLeaseTime < lease.RenewOnCallTime)
{
lease.Renew(lease.RenewOnCallTime);
}
}
// Token: 0x17000735 RID: 1845
// (get) Token: 0x06002685 RID: 9861 RVA: 0x0007EF18 File Offset: 0x0007D118
public IMessageSink NextSink
{
get
{
return this._nextSink;
}
}
// Token: 0x04000EFF RID: 3839
private IMessageSink _nextSink;
}
}
@@ -0,0 +1,28 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Lifetime
{
/// <summary>Indicates the possible lease states of a lifetime lease.</summary>
// Token: 0x020003D4 RID: 980
[ComVisible(true)]
[Serializable]
public enum LeaseState
{
/// <summary>The lease is not initialized.</summary>
// Token: 0x04000F01 RID: 3841
Null,
/// <summary>The lease has been created, but is not yet active.</summary>
// Token: 0x04000F02 RID: 3842
Initial,
/// <summary>The lease is active and has not expired.</summary>
// Token: 0x04000F03 RID: 3843
Active,
/// <summary>The lease has expired and is seeking sponsorship.</summary>
// Token: 0x04000F04 RID: 3844
Renewing,
/// <summary>The lease has expired and cannot be renewed.</summary>
// Token: 0x04000F05 RID: 3845
Expired
}
}
@@ -0,0 +1,123 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Lifetime
{
/// <summary>Controls the.NET remoting lifetime services.</summary>
// Token: 0x020003D5 RID: 981
[ComVisible(true)]
public sealed class LifetimeServices
{
/// <summary>Gets or sets the time interval between each activation of the lease manager to clean up expired leases.</summary>
/// <returns>The default amount of time the lease manager sleeps after checking for expired leases.</returns>
/// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure" />
/// </PermissionSet>
// Token: 0x17000736 RID: 1846
// (get) Token: 0x06002688 RID: 9864 RVA: 0x0007EF8C File Offset: 0x0007D18C
// (set) Token: 0x06002689 RID: 9865 RVA: 0x0007EF94 File Offset: 0x0007D194
public static TimeSpan LeaseManagerPollTime
{
get
{
return LifetimeServices._leaseManagerPollTime;
}
set
{
LifetimeServices._leaseManagerPollTime = value;
LifetimeServices._leaseManager.SetPollTime(value);
}
}
/// <summary>Gets or sets the initial lease time span for an <see cref="T:System.AppDomain" />.</summary>
/// <returns>The initial lease <see cref="T:System.TimeSpan" /> for objects that can have leases in the <see cref="T:System.AppDomain" />.</returns>
/// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure" />
/// </PermissionSet>
// Token: 0x17000737 RID: 1847
// (get) Token: 0x0600268A RID: 9866 RVA: 0x0007EFA8 File Offset: 0x0007D1A8
// (set) Token: 0x0600268B RID: 9867 RVA: 0x0007EFB0 File Offset: 0x0007D1B0
public static TimeSpan LeaseTime
{
get
{
return LifetimeServices._leaseTime;
}
set
{
LifetimeServices._leaseTime = value;
}
}
/// <summary>Gets or sets the amount of time by which the lease is extended every time a call comes in on the server object.</summary>
/// <returns>The <see cref="T:System.TimeSpan" /> by which a lifetime lease in the current <see cref="T:System.AppDomain" /> is extended after each call.</returns>
/// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure" />
/// </PermissionSet>
// Token: 0x17000738 RID: 1848
// (get) Token: 0x0600268C RID: 9868 RVA: 0x0007EFB8 File Offset: 0x0007D1B8
// (set) Token: 0x0600268D RID: 9869 RVA: 0x0007EFC0 File Offset: 0x0007D1C0
public static TimeSpan RenewOnCallTime
{
get
{
return LifetimeServices._renewOnCallTime;
}
set
{
LifetimeServices._renewOnCallTime = value;
}
}
/// <summary>Gets or sets the amount of time the lease manager waits for a sponsor to return with a lease renewal time.</summary>
/// <returns>The initial sponsorship time-out.</returns>
/// <exception cref="T:System.Security.SecurityException">At least one of the callers higher in the callstack does not have permission to configure remoting types and channels. This exception is thrown only when setting the property value. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure" />
/// </PermissionSet>
// Token: 0x17000739 RID: 1849
// (get) Token: 0x0600268E RID: 9870 RVA: 0x0007EFC8 File Offset: 0x0007D1C8
// (set) Token: 0x0600268F RID: 9871 RVA: 0x0007EFD0 File Offset: 0x0007D1D0
public static TimeSpan SponsorshipTimeout
{
get
{
return LifetimeServices._sponsorshipTimeout;
}
set
{
LifetimeServices._sponsorshipTimeout = value;
}
}
// Token: 0x06002690 RID: 9872 RVA: 0x0007EFD8 File Offset: 0x0007D1D8
internal static void TrackLifetime(ServerIdentity identity)
{
LifetimeServices._leaseManager.TrackLifetime(identity);
}
// Token: 0x06002691 RID: 9873 RVA: 0x0007EFE8 File Offset: 0x0007D1E8
internal static void StopTrackingLifetime(ServerIdentity identity)
{
LifetimeServices._leaseManager.StopTrackingLifetime(identity);
}
// Token: 0x04000F06 RID: 3846
private static TimeSpan _leaseManagerPollTime = TimeSpan.FromSeconds(10.0);
// Token: 0x04000F07 RID: 3847
private static TimeSpan _leaseTime = TimeSpan.FromMinutes(5.0);
// Token: 0x04000F08 RID: 3848
private static TimeSpan _renewOnCallTime = TimeSpan.FromMinutes(2.0);
// Token: 0x04000F09 RID: 3849
private static TimeSpan _sponsorshipTimeout = TimeSpan.FromMinutes(2.0);
// Token: 0x04000F0A RID: 3850
private static LeaseManager _leaseManager = new LeaseManager();
}
}