Keep remote server connection alive if it disconnects mid-replay

* We need to keep it alive until we've shut down the replay controller, and we
  keep that alive until the user explicitly closes the capture.
This commit is contained in:
baldurk
2020-09-01 11:08:01 +01:00
parent 9f5e6a725b
commit 865f9002da
2 changed files with 26 additions and 5 deletions
+25 -5
View File
@@ -340,7 +340,16 @@ void ReplayManager::DisconnectFromRemoteServer()
if(m_Remote)
{
QMutexLocker autolock(&m_RemoteLock);
m_Remote->ShutdownConnection();
// give the remote to the thread to shut down since the lifetime is tied to the replay
// controller it has.
if(m_Thread->isRunning())
{
m_OrphanedRemote = m_Remote;
}
else
{
m_Remote->ShutdownConnection();
}
}
m_RemoteHost = RemoteHost();
@@ -515,11 +524,22 @@ void ReplayManager::run(int proxyRenderer, const QString &capturefile, const Rep
}
}
// close the core renderer
if(m_Remote)
m_Remote->CloseCapture(m_Renderer);
// if the remote has been orphaned due to disconnection during replay, close the capture using it
// and then shut it down.
if(m_OrphanedRemote)
{
m_OrphanedRemote->CloseCapture(m_Renderer);
m_OrphanedRemote->ShutdownConnection();
m_OrphanedRemote = NULL;
}
else
m_Renderer->Shutdown();
{
// close the core renderer
if(m_Remote)
m_Remote->CloseCapture(m_Renderer);
else
m_Renderer->Shutdown();
}
m_Renderer = NULL;
+1
View File
@@ -132,6 +132,7 @@ private:
QMutex m_RemoteLock;
RemoteHost m_RemoteHost;
IRemoteServer *m_Remote = NULL;
IRemoteServer *m_OrphanedRemote = NULL;
volatile bool m_Running;
LambdaThread *m_Thread;