Ensure not to continue reconnecting while still aborting
This commit is contained in:
parent
ea2e26aace
commit
1156721822
|
@ -66,6 +66,7 @@ SyncthingConnection::SyncthingConnection(const QString &syncthingUrl, const QByt
|
||||||
, m_apiKey(apiKey)
|
, m_apiKey(apiKey)
|
||||||
, m_status(SyncthingStatus::Disconnected)
|
, m_status(SyncthingStatus::Disconnected)
|
||||||
, m_keepPolling(false)
|
, m_keepPolling(false)
|
||||||
|
, m_abortingAllRequests(false)
|
||||||
, m_abortingToReconnect(false)
|
, m_abortingToReconnect(false)
|
||||||
, m_requestCompletion(false)
|
, m_requestCompletion(false)
|
||||||
, m_lastEventId(0)
|
, m_lastEventId(0)
|
||||||
|
@ -254,6 +255,7 @@ void SyncthingConnection::disconnect()
|
||||||
*/
|
*/
|
||||||
void SyncthingConnection::abortAllRequests()
|
void SyncthingConnection::abortAllRequests()
|
||||||
{
|
{
|
||||||
|
m_abortingAllRequests = true;
|
||||||
if (m_configReply) {
|
if (m_configReply) {
|
||||||
m_configReply->abort();
|
m_configReply->abort();
|
||||||
}
|
}
|
||||||
|
@ -287,6 +289,9 @@ void SyncthingConnection::abortAllRequests()
|
||||||
for (auto *const reply : m_otherReplies) {
|
for (auto *const reply : m_otherReplies) {
|
||||||
reply->abort();
|
reply->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_abortingAllRequests = false;
|
||||||
|
handleAdditionalRequestCanceled();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -321,6 +321,7 @@ private:
|
||||||
QString m_password;
|
QString m_password;
|
||||||
SyncthingStatus m_status;
|
SyncthingStatus m_status;
|
||||||
bool m_keepPolling;
|
bool m_keepPolling;
|
||||||
|
bool m_abortingAllRequests;
|
||||||
bool m_abortingToReconnect;
|
bool m_abortingToReconnect;
|
||||||
bool m_requestCompletion;
|
bool m_requestCompletion;
|
||||||
int m_lastEventId;
|
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
|
* - 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
|
* statistics, ... are considered. So requests for QR code, logs, clearing errors, rescan, ... are not taken
|
||||||
* into account.
|
* into account.
|
||||||
|
* - This function will also return true as long as the method abortAllRequests() is executed.
|
||||||
*/
|
*/
|
||||||
inline bool SyncthingConnection::hasPendingRequests() const
|
inline bool SyncthingConnection::hasPendingRequests() const
|
||||||
{
|
{
|
||||||
return m_configReply || m_statusReply || (m_eventsReply && !m_hasEvents) || (m_diskEventsReply && !m_hasDiskEvents) || m_connectionsReply
|
return m_abortingAllRequests || m_configReply || m_statusReply || (m_eventsReply && !m_hasEvents) || (m_diskEventsReply && !m_hasDiskEvents)
|
||||||
|| m_dirStatsReply || m_devStatsReply || m_errorsReply || m_versionReply || !m_otherReplies.isEmpty();
|
|| m_connectionsReply || m_dirStatsReply || m_devStatsReply || m_errorsReply || m_versionReply || !m_otherReplies.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in New Issue