summaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
author Nathan Harold <nharold@google.com> 2021-10-20 12:42:27 -0700
committer Nathan Harold <nharold@google.com> 2021-10-20 14:00:46 -0700
commit1fe18a79d5c8e7e7138465fb086df4417e84f69f (patch)
treef352c5eb69e7d273d51d5324a6b3f2e545cdf837 /api/api.go
parentc12df4f3b10a7797c771b17bc2516250a3450b9b (diff)
Ensure that ScanInfo is cached before callbacks fire
Fixes a regression that was introduced in aosp/1312940. There is a critical section in requestNetworkScan after the scanId has been generated and before the ScanInfo is added to the cache. If during this time a callback fires on a separate thread, it will not yet find the ScanInfo record, and due to strict checking, this causes a RuntimeException. This CL re-expands the synchronized block to cover the critical section, and clarifies a little bounds checking. Note: this change is not ideal. This means that all callbacks for all scans will be blocked while a request for a new scan is being made, which was the motivation behind the change that introduced this regression. But, a narrow performance hit is better than a crash, and it's not worth the complexity of a bigger fix. Bug: 200634560 Test: compilation Change-Id: I4670da109256170121ceb6d8fbad0efda310335f
Diffstat (limited to 'api/api.go')
0 files changed, 0 insertions, 0 deletions