109348 【备份还原4.0.14】选择在移动设备上备份的系统进行系统还原时,在到还原中的步骤时,拔出移动设备,进度卡在100%不动

This commit is contained in:
zhaominyong 2022-03-09 16:54:25 +08:00
parent 4c80ddfbde
commit 5db97cf5f4
4 changed files with 30 additions and 6 deletions

View File

@ -18,6 +18,7 @@ UDiskDataRestoreProxy::UDiskDataRestoreProxy()
m_bSuccess = false; m_bSuccess = false;
m_isFinished = false; m_isFinished = false;
m_p = nullptr; m_p = nullptr;
m_isForce = false;
} }
/** /**
@ -136,6 +137,7 @@ void UDiskDataRestoreProxy::restoreData()
m_p = new RsyncPathToDirProcess(this); m_p = new RsyncPathToDirProcess(this);
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskDataRestoreProxy::progress); connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskDataRestoreProxy::progress);
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) { connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
m_isForce = false;
m_bSuccess = result; m_bSuccess = result;
m_isFinished = true; m_isFinished = true;
if (result) { if (result) {
@ -158,10 +160,19 @@ void UDiskDataRestoreProxy::restoreData()
bool UDiskDataRestoreProxy::checkUdiskExists() bool UDiskDataRestoreProxy::checkUdiskExists()
{ {
if (!m_isFinished) { if (!m_isFinished) {
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) // 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
}
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {
m_p->stop(); m_p->stop();
else // 10s钟后如果还没有退出则强制退出
QTimer::singleShot(10*1000, this, &UDiskDataRestoreProxy::checkUdiskExists);
m_isForce = true;
} else {
QTimer::singleShot(1*1000, this, &UDiskDataRestoreProxy::checkUdiskExists); QTimer::singleShot(1*1000, this, &UDiskDataRestoreProxy::checkUdiskExists);
}
} }
return true; return true;

View File

@ -56,7 +56,8 @@ private:
RsyncPathToDirProcess *m_p; RsyncPathToDirProcess *m_p;
// 当前备份节点 // 当前备份节点
ParseBackupList::BackupPoint m_backupPoint; ParseBackupList::BackupPoint m_backupPoint;
// 强制结束标志(stop后没反应的情况系统处于睡眠状态)
bool m_isForce;
}; };
#endif // UDISKDATARESTOREPROXY_H #endif // UDISKDATARESTOREPROXY_H

View File

@ -18,6 +18,7 @@ UDiskSystemRestoreProxy::UDiskSystemRestoreProxy()
{ {
m_isFinished = false; m_isFinished = false;
m_p = nullptr; m_p = nullptr;
m_isForce = false;
} }
/** /**
@ -378,6 +379,7 @@ void UDiskSystemRestoreProxy::restoreSystem()
m_p = new RsyncPathToDirProcess(this); m_p = new RsyncPathToDirProcess(this);
connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskSystemRestoreProxy::progress); connect(m_p, &RsyncPathToDirProcess::progress, this, &UDiskSystemRestoreProxy::progress);
connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) { connect(m_p, &RsyncPathToDirProcess::finished, this, [&](bool result) {
m_isForce = false;
if (result) { if (result) {
QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss"); QString time = QDateTime::currentDateTime().toString("yy-MM-dd hh:mm:ss");
// Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid)); // Utils::writeBackupLog(time + "," + m_curUuid + "," + QString::number(m_backupWrapper.m_type) + ",,," + QString::number(m_backupWrapper.m_frontUid));
@ -451,7 +453,6 @@ void UDiskSystemRestoreProxy::updateGrubUUid()
} }
} }
/** /**
* @brief * @brief
* @return true-false- * @return true-false-
@ -459,10 +460,19 @@ void UDiskSystemRestoreProxy::updateGrubUUid()
bool UDiskSystemRestoreProxy::checkUdiskExists() bool UDiskSystemRestoreProxy::checkUdiskExists()
{ {
if (!m_isFinished) { if (!m_isFinished) {
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) // 拔掉U盘后没有响应的场景怀疑可能是某应用程序关闭引起希望不是dbus服务关掉了
if (m_isForce) {
emit this->workResult(false);
}
if (Utils::isDirEmpty(m_backupPath) && m_p != nullptr) {
m_p->stop(); m_p->stop();
else // 10s钟后如果还没有退出则强制退出
QTimer::singleShot(10*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists);
m_isForce = true;
} else {
QTimer::singleShot(1*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists); QTimer::singleShot(1*1000, this, &UDiskSystemRestoreProxy::checkUdiskExists);
}
} }
return true; return true;

View File

@ -72,6 +72,8 @@ private:
RsyncPathToDirProcess *m_p; RsyncPathToDirProcess *m_p;
// 当前备份节点 // 当前备份节点
ParseBackupList::BackupPoint m_backupPoint; ParseBackupList::BackupPoint m_backupPoint;
// 强制结束标志(stop后没反应的情况系统处于睡眠状态)
bool m_isForce;
}; };
#endif // UDISKSYSTEMRESTOREPROXY_H #endif // UDISKSYSTEMRESTOREPROXY_H