GoogleChromeLabs / chromeos_smart_card_connector

Smart Card Connector App for Chrome OS
https://chrome.google.com/webstore/detail/smart-card-connector/khpfeaanjngmcnplbdlpegiifgpfgdco
Apache License 2.0
133 stars 50 forks source link

[libusb] Handle transfers in FIFO #1105

Closed emaxx-google closed 7 months ago

emaxx-google commented 8 months ago

When choosing which of active Libusb transfers should receive a reply from the JS API, use the FIFO order rather than a random order. Also change the internal structures so that FIFO is used uniformly, which we'll use in follow-ups for correctly enqueueing JS API calls.

The FIFO order is more intuitive and better corresponds to Libusb behavior on other platforms. Moreover, the FIFO property will be crucial to avoid the situation when an enqueued JS API call is discarded because the transfer happened to be resolved by the call originally triggered by a different transfer.

This contributes to #462 and #1104.

github-actions[bot] commented 8 months ago

Continuous Integration: All tests passed. C/C++ test coverage: 73.16% lines.

emaxx-google commented 8 months ago

LGTM - also, I realized that I was reviewing these CLs in the wrong order, which explains why I didn't know some of the code during my earlier reviews :)

Oops. Next time I'll explicitly mention the numbers in PR titles or comments. Thanks for the reviews; I've added some tests.

github-actions[bot] commented 8 months ago

Continuous Integration: All tests passed. C/C++ test coverage: 73.19% lines.