1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-28 19:49:28 +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> /// </summary>
private byte[] mFileData; private byte[] mFileData;
private DateTime mLastPing;
/// <summary> /// <summary>
/// Constructor, invoked from CreateInstanceAndUnwrap(). /// Constructor, invoked from CreateInstanceAndUnwrap().
@ -46,6 +48,8 @@ namespace PluginCommon {
public PluginManager() { public PluginManager() {
Debug.WriteLine("PluginManager ctor (id=" + AppDomain.CurrentDomain.Id + ")"); Debug.WriteLine("PluginManager ctor (id=" + AppDomain.CurrentDomain.Id + ")");
mLastPing = DateTime.Now;
// Seems to require [SecurityCritical] // Seems to require [SecurityCritical]
//Type lsc = Type.GetType("System.Runtime.Remoting.Lifetime.LifetimeServices"); //Type lsc = Type.GetType("System.Runtime.Remoting.Lifetime.LifetimeServices");
//PropertyInfo prop = lsc.GetProperty("LeaseTime"); //PropertyInfo prop = lsc.GetProperty("LeaseTime");
@ -75,7 +79,9 @@ namespace PluginCommon {
public int Ping(int val) { public int Ping(int val) {
Debug.WriteLine("PluginManager Ping tid=" + Thread.CurrentThread.ManagedThreadId + Debug.WriteLine("PluginManager Ping tid=" + Thread.CurrentThread.ManagedThreadId +
" (id=" + AppDomain.CurrentDomain.Id + "): " + val); " (id=" + AppDomain.CurrentDomain.Id + "): " + val);
return val + 1; int result = (int)(DateTime.Now - mLastPing).TotalSeconds;
mLastPing = DateTime.Now;
return result;
} }
/// <summary> /// <summary>

View File

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