Add CancellationFlag::Uncancel and on calls to ClientProxy::AddCancellationFlag, if a flag is already in the map, uncancel it. This will address the case when users use NC to share/receive a file, then cancel in the middle because the wrong file was selected, and then re-do right after. Without this change, the second share/receive process will be seen as cancelled with cancellation flags enabled. However this change will uncancel the flag which is added in RequestConnection and OnConnectionInitiated in the NS flow.
PiperOrigin-RevId: 540633470
To prevent invalid access of already destroyed CancellationFlag pointers, do not erase the map entry of a CancellationFlag in ClientProxy::CancelEndpoint. Crashes were caused by consumers accessing CancellationFlag::Cancelled to check if the flags were cancelled, however since the flags was destroyed by erasing the map entry in ClientProxy::CancelEndpoint, consumers are calling gabrage memory.
PiperOrigin-RevId: 536470187
To prevent invalid access of already destroyed CancellationFlag pointers, do not clear the map of CancellationFlags in ClientProxy::CancelAllEndpoints. Crashes
were caused by consumers accessing CancellationFlag::Cancelled to check if the flags were cancelled, however since the flags were destroyed by erasing the map in ClientProxy::CancelAllEndpoints, consumers are calling gabrage memory.
PiperOrigin-RevId: 535284214
* Fix bandwidth upgrade service ID usage. For instance, no longer use the inaccurate service ID from ClientProxy.
* Add more fine-grained upgraded endpoint tracking using both service IDs and endpoint IDs
* Only "revert" bandwidth-upgrade mediums--for example, stop accepting connections on a server socket--for a service when the last endpoint for that service is finished.
These changes are necessary to support multiple services (e.g., Nearby Share and Phone Hub) and multiple mediums (e.g., WebRTC and WLAN).
PiperOrigin-RevId: 442021257