1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +00:00

Increase verbosity of sandbox ping

This commit is contained in:
Andy McFadden 2020-07-18 17:21:49 -07:00
parent 1b2679d712
commit de6e61a37e
2 changed files with 11 additions and 4 deletions

View File

@ -39,6 +39,8 @@ namespace PluginCommon {
/// </summary>
private byte[] mFileData;
private DateTime mLastPing;
/// <summary>
/// Constructor, invoked from CreateInstanceAndUnwrap().
@ -46,6 +48,8 @@ namespace PluginCommon {
public PluginManager() {
Debug.WriteLine("PluginManager ctor (id=" + AppDomain.CurrentDomain.Id + ")");
mLastPing = DateTime.Now;
// Seems to require [SecurityCritical]
//Type lsc = Type.GetType("System.Runtime.Remoting.Lifetime.LifetimeServices");
//PropertyInfo prop = lsc.GetProperty("LeaseTime");
@ -75,7 +79,9 @@ namespace PluginCommon {
public int Ping(int val) {
Debug.WriteLine("PluginManager Ping tid=" + Thread.CurrentThread.ManagedThreadId +
" (id=" + AppDomain.CurrentDomain.Id + "): " + val);
return val + 1;
int result = (int)(DateTime.Now - mLastPing).TotalSeconds;
mLastPing = DateTime.Now;
return result;
}
/// <summary>

View File

@ -84,9 +84,10 @@ namespace SourceGen.Sandbox {
// waits for the currently-executing timer event to finish. So wrap
// everything in try/catch.
try {
mPluginManager.Instance.Ping(0);
//Debug.WriteLine("KeepAlive tid=" +
// System.Threading.Thread.CurrentThread.ManagedThreadId);
int result = mPluginManager.Instance.Ping(1000);
Debug.WriteLine("KeepAlive tid=" +
System.Threading.Thread.CurrentThread.ManagedThreadId +
" result=" + result);
} catch (Exception ex) {
Debug.WriteLine("Keep-alive timer failed: " + ex.Message);
}