Refactor RemoteHost to be copyable with shared storage

* This allows RemoteHost handles to still be valid and usable (if returning
  empty data) when they are deleted/removed if the device is disconnected, as
  well as providing better multi-thread access (they lock internally)
This commit is contained in:
baldurk
2019-07-30 16:20:09 +01:00
parent da289fdbcc
commit 06f2e61b8f
15 changed files with 626 additions and 355 deletions
+4 -12
View File
@@ -705,9 +705,7 @@ bool LiveCapture::checkAllowClose()
// we either have to save or delete the capture. Make sure that if it's remote that we are able
// to by having an active connection or replay context on that host.
if(suppressRemoteWarning == false && (!m_Connection || !m_Connection->Connected()) &&
!cap->local && (!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected))
!cap->local && m_Ctx.Replay().CurrentRemote().Hostname() != rdcstr(m_Hostname))
{
QMessageBox::StandardButton res2 = RDDialog::question(
this, tr("No active replay context"),
@@ -752,9 +750,7 @@ void LiveCapture::openCapture(Capture *cap)
{
cap->opened = true;
if(!cap->local && (!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected))
if(!cap->local && m_Ctx.Replay().CurrentRemote().Hostname() != rdcstr(m_Hostname))
{
RDDialog::critical(
this, tr("No active replay context"),
@@ -821,9 +817,7 @@ bool LiveCapture::saveCapture(Capture *cap, QString path)
}
else
{
if(!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected)
if(m_Ctx.Replay().CurrentRemote().Hostname() != rdcstr(m_Hostname))
{
RDDialog::critical(this, tr("No active replay context"),
tr("This capture is on remote host %1 and there is no active replay "
@@ -1054,9 +1048,7 @@ void LiveCapture::connectionClosed()
// to this machine as a remote context
if(!cap->local)
{
if(!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected)
if(m_Ctx.Replay().CurrentRemote().Hostname() != rdcstr(m_Hostname))
return;
}