Fix resuming devs when network not metered anymore after 57d47de7
This commit is contained in:
parent
960f43f82a
commit
572e82cec0
|
@ -297,10 +297,10 @@ void SyncthingConnection::handleMeteredConnection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasDevicesToPause) {
|
if (hasDevicesToPause) {
|
||||||
pauseDevice(m_devsPausedDueToMeteredConnection);
|
pauseResumeDevice(m_devsPausedDueToMeteredConnection, true, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resumeDevice(m_devsPausedDueToMeteredConnection);
|
pauseResumeDevice(m_devsPausedDueToMeteredConnection, false, true);
|
||||||
m_devsPausedDueToMeteredConnection.clear();
|
m_devsPausedDueToMeteredConnection.clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -365,7 +365,7 @@ private:
|
||||||
Reply prepareReply(QNetworkReply *&expectedReply, bool readData = true, bool handleAborting = true);
|
Reply prepareReply(QNetworkReply *&expectedReply, bool readData = true, bool handleAborting = true);
|
||||||
Reply prepareReply(QList<QNetworkReply *> &expectedReplies, bool readData = true, bool handleAborting = true);
|
Reply prepareReply(QList<QNetworkReply *> &expectedReplies, bool readData = true, bool handleAborting = true);
|
||||||
Reply handleReply(QNetworkReply *reply, bool readData, bool handleAborting);
|
Reply handleReply(QNetworkReply *reply, bool readData, bool handleAborting);
|
||||||
bool pauseResumeDevice(const QStringList &devIds, bool paused);
|
bool pauseResumeDevice(const QStringList &devIds, bool paused, bool dueToMetered = false);
|
||||||
bool pauseResumeDirectory(const QStringList &dirIds, bool paused);
|
bool pauseResumeDirectory(const QStringList &dirIds, bool paused);
|
||||||
SyncthingDir *addDirInfo(std::vector<SyncthingDir> &dirs, const QString &dirId);
|
SyncthingDir *addDirInfo(std::vector<SyncthingDir> &dirs, const QString &dirId);
|
||||||
SyncthingDev *addDevInfo(std::vector<SyncthingDev> &devs, const QString &devId);
|
SyncthingDev *addDevInfo(std::vector<SyncthingDev> &devs, const QString &devId);
|
||||||
|
|
|
@ -341,7 +341,7 @@ bool SyncthingConnection::resumeAllDevs()
|
||||||
* \remarks This might result in errors caused by Syncthing not handling E notation correctly when using Qt < 5.9,
|
* \remarks This might result in errors caused by Syncthing not handling E notation correctly when using Qt < 5.9,
|
||||||
* see https://github.com/syncthing/syncthing/issues/4001.
|
* see https://github.com/syncthing/syncthing/issues/4001.
|
||||||
*/
|
*/
|
||||||
bool SyncthingConnection::pauseResumeDevice(const QStringList &devIds, bool paused)
|
bool SyncthingConnection::pauseResumeDevice(const QStringList &devIds, bool paused, bool dueToMetered)
|
||||||
{
|
{
|
||||||
if (devIds.isEmpty()) {
|
if (devIds.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -364,7 +364,7 @@ bool SyncthingConnection::pauseResumeDevice(const QStringList &devIds, bool paus
|
||||||
QObject::connect(reply, &QNetworkReply::finished, this, &SyncthingConnection::readDevPauseResume);
|
QObject::connect(reply, &QNetworkReply::finished, this, &SyncthingConnection::readDevPauseResume);
|
||||||
|
|
||||||
// avoid considering manually paused or resumed devices when the network connection is no longer metered
|
// avoid considering manually paused or resumed devices when the network connection is no longer metered
|
||||||
if (!m_devsPausedDueToMeteredConnection.isEmpty()) {
|
if (!dueToMetered && !m_devsPausedDueToMeteredConnection.isEmpty()) {
|
||||||
for (const auto &devId : devIds) {
|
for (const auto &devId : devIds) {
|
||||||
m_devsPausedDueToMeteredConnection.removeAll(devId);
|
m_devsPausedDueToMeteredConnection.removeAll(devId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue