mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[DeckShare] Time the share-list round trip and backstop silently-destroyed intent chains
This commit is contained in:
parent
65c2378a81
commit
d8cc5522f2
4 changed files with 34 additions and 2 deletions
|
|
@ -313,6 +313,10 @@ void IntentUrlParser::startNextChain()
|
|||
connect(finalIntent, &Intent::finished, this, [this]() { chainEnded(true); });
|
||||
connect(finalIntent, &Intent::failed, this, [this]() { chainEnded(false); });
|
||||
connect(finalIntent, &Intent::cancelled, this, [this]() { chainEnded(false); });
|
||||
// Backstop: if the final intent is destroyed without emitting a terminal
|
||||
// signal (e.g. a network error dropped it while running), end the chain so
|
||||
// later links are not queued and dropped for the rest of the session.
|
||||
chainBackstopConnection = connect(finalIntent, &QObject::destroyed, this, &IntentUrlParser::onChainIntentDestroyed);
|
||||
|
||||
chain.intents.first()->execute();
|
||||
}
|
||||
|
|
@ -320,6 +324,7 @@ void IntentUrlParser::startNextChain()
|
|||
void IntentUrlParser::chainEnded(bool chainSucceeded)
|
||||
{
|
||||
chainRunning = false;
|
||||
QObject::disconnect(chainBackstopConnection);
|
||||
|
||||
const PendingIntentChain chain = pendingChains.takeFirst();
|
||||
|
||||
|
|
@ -338,6 +343,15 @@ void IntentUrlParser::chainEnded(bool chainSucceeded)
|
|||
}
|
||||
}
|
||||
|
||||
void IntentUrlParser::onChainIntentDestroyed()
|
||||
{
|
||||
if (!chainRunning) {
|
||||
return;
|
||||
}
|
||||
qCWarning(UrlParserLog) << "Share-link intent destroyed without a terminal signal; ending its chain";
|
||||
chainEnded(false);
|
||||
}
|
||||
|
||||
void IntentUrlParser::restorePreviousServer(const PendingIntentChain &chain)
|
||||
{
|
||||
if (chain.previousServerHost.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue