Fix concurrent Unity callback routing - #1008
Conversation
|
Heads-up from #1019:
Suggested change, in this branch's shape: private void _getCurrentOfferingForPlacement(string offeringJson)
{
var response = JSON.Parse(offeringJson);
if (!TryTakeCallback(response, out GetCurrentOfferingForPlacementFunc callback) || callback == null)
{
return;
}
// The error check has to come first: both native wrappers send only an "error" key on
// failure, so testing for a missing "offering" first reports every failure as
// "no offering configured for this placement".
if (ResponseHasError(response))
{
callback(null, new Error(response["error"]));
return;
}
if (response["offering"] == null)
{
callback(null, null);
return;
}
callback(new Offering(response["offering"]), null);
}#1019 makes this exact change against |
68246df to
4fc0292
Compare
4fc0292 to
42913c8
Compare
42913c8 to
1ed37b2
Compare
1ed37b2 to
3a7f6d8
Compare
3a7f6d8 to
0ca00b9
Compare
Motivation
Purchasesstores one mutable callback per operation. Two overlapping calls can overwrite each other, so the first response invokes the wrong callback and the other response is dropped.Description
Correlate every one-shot callback with the request IDs added by the earlier PRs in this stack.
No public API changes in this final layer.
Testing
./scripts/check-meta-files.shpassed./scripts/check-android-keep-annotations.shpassedPhysical-device concurrency smoke tests were not run.
Stack