[*] Waterfall fix
This commit is contained in:
parent
fb1b016c87
commit
b60b580d62
@ -345,7 +345,9 @@ struct AuWaterfall : AuEnableSharedFromThis<AuWaterfall>
|
||||
|
||||
if (this->bDone)
|
||||
{
|
||||
if (this->bFailed)
|
||||
auto [bSendSuccess, bSendFail] = this->GetDispatch(true);
|
||||
|
||||
if (bSendFail)
|
||||
{
|
||||
onFailure();
|
||||
}
|
||||
@ -364,7 +366,9 @@ struct AuWaterfall : AuEnableSharedFromThis<AuWaterfall>
|
||||
|
||||
if (this->bDone)
|
||||
{
|
||||
if (!this->bFailed)
|
||||
auto [bSendSuccess, bSendFail] = this->GetDispatch(true);
|
||||
|
||||
if (bSendSuccess)
|
||||
{
|
||||
onSuccess();
|
||||
}
|
||||
@ -384,25 +388,41 @@ struct AuWaterfall : AuEnableSharedFromThis<AuWaterfall>
|
||||
|
||||
private:
|
||||
|
||||
void FireDelayed()
|
||||
AuPair<bool, bool> GetDispatch(bool bForce = false)
|
||||
{
|
||||
bool bSendSuccess {};
|
||||
bool bSendFail {};
|
||||
|
||||
|
||||
if ((this->bFailOnAny && bool(this->uCountOfFailed)) ||
|
||||
(this->uCountOfFailed == this->uCount))
|
||||
{
|
||||
bSendFail = bool(this->onFailure.size());
|
||||
bSendFail = bool(this->onFailure.size()) || bForce;
|
||||
}
|
||||
else if ((!this->bFailOnAny || !this->uCountOfFailed) &&
|
||||
this->uCountOfComplete == this->uCount)
|
||||
{
|
||||
bSendSuccess = bool(this->onSuccess.size());
|
||||
bSendSuccess = bool(this->onSuccess.size()) || bForce;
|
||||
}
|
||||
else if (!this->bFailOnAny && ((this->uCountOfComplete + this->uCountOfFailed) == this->uCount))
|
||||
{
|
||||
bSendSuccess = bool(this->onSuccess.size());
|
||||
bSendSuccess = bool(this->onSuccess.size()) || bForce;
|
||||
}
|
||||
|
||||
return AuMakePair(bSendSuccess, bSendFail);
|
||||
}
|
||||
|
||||
void FireDelayed()
|
||||
{
|
||||
auto [bSendSuccess, bSendFail] = this->GetDispatch(false);
|
||||
|
||||
if (!bSendSuccess && !bSendFail)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (bSendFail)
|
||||
{
|
||||
this->bFailed = true;
|
||||
}
|
||||
|
||||
if (AuExchange(this->bDone, true))
|
||||
@ -417,7 +437,6 @@ private:
|
||||
}
|
||||
else if (bSendFail)
|
||||
{
|
||||
this->bFailed = true;
|
||||
this->pFuture->Fail();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user