Ensure not to continue reconnecting while still aborting

This commit is contained in:
Martchus 2018-12-26 01:14:01 +01:00
parent ea2e26aace
commit 1156721822
2 changed files with 9 additions and 2 deletions

View File

@ -66,6 +66,7 @@ SyncthingConnection::SyncthingConnection(const QString &syncthingUrl, const QByt
, m_apiKey(apiKey)
, m_status(SyncthingStatus::Disconnected)
, m_keepPolling(false)
, m_abortingAllRequests(false)
, m_abortingToReconnect(false)
, m_requestCompletion(false)
, m_lastEventId(0)
@ -254,6 +255,7 @@ void SyncthingConnection::disconnect()
*/
void SyncthingConnection::abortAllRequests()
{
m_abortingAllRequests = true;
if (m_configReply) {
m_configReply->abort();
}
@ -287,6 +289,9 @@ void SyncthingConnection::abortAllRequests()
for (auto *const reply : m_otherReplies) {
reply->abort();
}
m_abortingAllRequests = false;
handleAdditionalRequestCanceled();
}
/*!

View File

@ -321,6 +321,7 @@ private:
QString m_password;
SyncthingStatus m_status;
bool m_keepPolling;
bool m_abortingAllRequests;
bool m_abortingToReconnect;
bool m_requestCompletion;
int m_lastEventId;
@ -457,11 +458,12 @@ inline bool SyncthingConnection::isConnected() const
* - Only requests which contribute to the overall state and population of myId(), dirInfo(), devInfo(), traffic
* statistics, ... are considered. So requests for QR code, logs, clearing errors, rescan, ... are not taken
* into account.
* - This function will also return true as long as the method abortAllRequests() is executed.
*/
inline bool SyncthingConnection::hasPendingRequests() const
{
return m_configReply || m_statusReply || (m_eventsReply && !m_hasEvents) || (m_diskEventsReply && !m_hasDiskEvents) || m_connectionsReply
|| m_dirStatsReply || m_devStatsReply || m_errorsReply || m_versionReply || !m_otherReplies.isEmpty();
return m_abortingAllRequests || m_configReply || m_statusReply || (m_eventsReply && !m_hasEvents) || (m_diskEventsReply && !m_hasDiskEvents)
|| m_connectionsReply || m_dirStatsReply || m_devStatsReply || m_errorsReply || m_versionReply || !m_otherReplies.isEmpty();
}
/*!