Ping the connected host regularly and check other hosts at lower freq.

* This lets us detect when a remote server has been disconnected and
  needs to be restarted, as well as alerting the user if this happens in
  the middle of a replay session.
* Pinging other hosts means the context switcher is reasonably up to
  date if one of them comes up.
This commit is contained in:
baldurk
2016-08-23 15:21:52 +02:00
parent 0ddfd3d65b
commit f8bbedeb8b
5 changed files with 148 additions and 11 deletions
+25
View File
@@ -70,6 +70,8 @@ namespace renderdocui.Code
private List<InvokeHandle> m_renderQueue;
private InvokeHandle m_current = null;
private bool m_CopyInProgress = false;
////////////////////////////////////////////
// Interface
@@ -217,8 +219,13 @@ namespace renderdocui.Code
{
Helpers.NewThread(new ThreadStart(() =>
{
// prevent pings while copying off-thread
m_CopyInProgress = true;
remotepath = m_Remote.CopyCaptureToRemote(localpath, ref progress);
m_CopyInProgress = false;
copied = true;
})).Start();
}
@@ -271,8 +278,13 @@ namespace renderdocui.Code
{
Helpers.NewThread(new ThreadStart(() =>
{
// prevent pings while copying off-thread
m_CopyInProgress = true;
m_Remote.CopyCaptureFromRemote(remotepath, localpath, ref progress);
m_CopyInProgress = false;
copied = true;
})).Start();
}
@@ -328,6 +340,19 @@ namespace renderdocui.Code
m_Remote = null;
}
public void PingRemote()
{
if(m_CopyInProgress)
return;
// must only happen on render thread if running
if ((!Running || m_Thread == Thread.CurrentThread) && m_Remote != null)
{
if (!m_Remote.Ping())
m_RemoteHost.ServerRunning = false;
}
}
public ReplayCreateException InitException = null;
public void CloseThreadSync()