Refactor transaction label timeout handling and dont leak labels
Problem: It was found that several AVRCP Controller functions would allocate transaction labels without setting transaction timeouts. This would cause labels to leak if something went wrong, either in lower levels of code, or on the remote device. Once our device leaked enough labels, we could no longer allocate labels for operations, which would render the connection effectively useless Solution: We previously added debugging to check which transaction types were leaking labels. We've used those results with careful code review to refactor the transaction label code so its much harder to leak labels. First, context was added to get_transaction, which enables us to better track which transactions have which labels. Second, the various build_and_send_* commands now *all* start transaction timers for their outgoing commands. This means Vendor, Passthrough, and Browsing all have command timeouts, instead of just Vendor commands. Third, the transaction timer/timeout code path has been unified into one timer. Callbacks for browse timeout events have been added as well, so that upper layers know when something has gone wrong. Bug: 272585347 Test: Connect a recent device and browse, look at transaction labels in logs and dumpsys Change-Id: Ieb73aee5532c06f79265e204e739d8e15c153ae2
Loading
Please register or sign in to comment