Commit Graph
264 Commits
Author SHA1 Message Date
Janusz Sobczak cce7cf59b9 Replace std::function with AnyInvocable
PiperOrigin-RevId: 555650115
2023-08-10 14:17:31 -07:00
Janusz Sobczak 5393daf9f1 Merge logging and types build targets
Both "types" and "logging" build targets included "logging.h"
Merging them together avoids circular dependencies.

PiperOrigin-RevId: 555262816
2023-08-09 19:13:12 -07:00
Guogang Li b798798f5f Log medium type for discovered endpoint
PiperOrigin-RevId: 553510472
2023-08-09 19:09:42 -07:00
Janusz Sobczak 5acf702660 Use endpoint lost alarms on PCP handler thread only
endpoint_lost_by_medium_alarms_ should be accessed only
on PCP handler thread to avoid race conditions.
Added thread annotations to protect against accidental use on a different thread.
Test only change.

PiperOrigin-RevId: 551919704
2023-07-28 12:21:32 -07:00
Guogang Li 6d886e3fc8 Fixed some issues in analytics data
PiperOrigin-RevId: 551900985
2023-07-28 11:13:07 -07:00
Janusz Sobczak f3bbb8caeb Fix race condition in ThroughputRecorder
PiperOrigin-RevId: 551361687
2023-07-26 17:28:45 -07:00
Janusz Sobczak 2c1ed158bc Add StopDiscovery call
Test only change.

PiperOrigin-RevId: 551358525
2023-07-26 17:14:08 -07:00
Janusz Sobczak 35acd3d849 Destroy ThroughputRecorder when PendingPayload is destroyed
This fixes a race condition where a Tp Recorder was used after being destroyed.

PiperOrigin-RevId: 551350023
2023-07-26 16:36:25 -07:00
Janusz Sobczak cae06bd15d Close executors in BasePcpHandler::Shutdown
The client can call DisconnectFromEndpointManager() explicitly before
BasePcpHandler is shut down. In this case, th executors were not terminated
inside BasePcpHandler::Shutdown()
This caused use-after-free errors in BasePcpHandlerTest.IoError_RequestConnectionFails

PiperOrigin-RevId: 551340708
2023-07-26 16:00:08 -07:00
Anay Wadhera 4958a32c35 make ResultCallback a bare function type and convert to AnyInvocable
PiperOrigin-RevId: 551081080
2023-07-25 21:07:48 -07:00
Janusz Sobczak c9d1b69d41 Set expected latch before sending messages
This closes a time window where the sent message was received before the latch was
configured.

PiperOrigin-RevId: 551050923
2023-07-25 18:01:49 -07:00
Janusz Sobczak c6d96b5971 Fix minor defects
Fixes use-after-free and NPE errors.

PiperOrigin-RevId: 551042892
2023-07-25 17:20:31 -07:00
Janusz Sobczak ae69b8ff4e Protect PendingPayload from use-after-free errors.
Protects against race conditions where a PendingPayload is destroyed when
another thread is still accessing it.

PiperOrigin-RevId: 550990038
2023-07-25 14:04:11 -07:00
hai007 15d24c08a5 Add sequence number for keep alive packet
PiperOrigin-RevId: 550613263
2023-07-24 10:59:52 -07:00
Janusz Sobczak 2c08cfc9e8 Close BaseEndpointChannel once
Closing the bluetoth socket and streams more than once is wasteful and error prone.

PiperOrigin-RevId: 549964135
2023-07-21 09:12:05 -07:00
Janusz Sobczak 2e1ed2b465 Fix wifi test flakiness
PiperOrigin-RevId: 549683201
2023-07-20 11:06:44 -07:00
Anay Wadhera 8450f2b607 add ConnectionsDevice/PresenceDevice to offline frames builders.
PiperOrigin-RevId: 549380626
2023-07-19 11:46:30 -07:00
Janusz Sobczak 6d5eab04d3 Work around race condition during encryption setup
The sending party may finish setting up encryption and start
sending encrypted packets while the receiving party is still configuring
encryption and expecting unencrypted packets

PiperOrigin-RevId: 549267838
2023-07-19 03:47:10 -07:00
Anay Wadhera bc68a6d71c Implement updateDiscoveryOptions in pcp handler.
PiperOrigin-RevId: 548177687
2023-07-14 11:30:08 -07:00
Janusz Sobczak 9f42452386 Fix PCP handler cleanup
All tasks in base_pcp_handler must complete before
p2p_cluster_pcp_handler is destroyed to prevent use-after-free errors.

Added a couple of missing StopDiscovery calls.

PiperOrigin-RevId: 547931350
2023-07-13 14:56:14 -07:00
Janusz Sobczak 31e4b45dd4 Sync before checking logs
The events are logged on a different threads. We should wait until all logs
are processed before verifying expectations.

PiperOrigin-RevId: 547926810
2023-07-13 14:41:36 -07:00
Hai Shang 66d101926a internal clean up
PiperOrigin-RevId: 547874111
2023-07-13 11:56:55 -07:00
Janusz Sobczak 11ed2cec74 Improve timing in OfflineServiceControllerTest
Some of the tests are flaky.
Significantly increased timeouts will give us confidence that
tests are failing due to a defect and not due to a test taking a little
bit more time than usual.

PiperOrigin-RevId: 547819011
2023-07-13 09:10:35 -07:00
Janusz Sobczak 02e37e8a0c Fix flakiness in analytics
`session_was_logged_` could be set out of order if a new session started
immediately after terminating the previous. Fixing that.

Check the logged messages rather then the voltile analytics recorder state
in the tests.

PiperOrigin-RevId: 547732773
2023-07-13 02:35:21 -07:00
Guogang Li 4a71c4d2d0 Move NS implementation to third party folder
PiperOrigin-RevId: 546966492
2023-07-10 13:39:42 -07:00
Anay Wadhera eff0e2d3c6 Commonize callback construction for discovery.
PiperOrigin-RevId: 546934102
2023-07-10 11:35:34 -07:00
Anay Wadhera 4ecbd3bca1 Filter devices based on type when listening for incoming connections.
PiperOrigin-RevId: 546124493
2023-07-06 16:40:00 -07:00
Anay Wadhera 5369c33112 fix tsan error in NC when accessing discovered_endpoints
PiperOrigin-RevId: 546060069
2023-07-06 12:22:55 -07:00
Anay Wadhera 4a185d0317 Add NearbyDevice::ToProto() API
PiperOrigin-RevId: 546055852
2023-07-06 12:07:01 -07:00
hai007 036d4ee490 Exchange ClientIntroductionFrame/ClientIntroductionAckFrame after reconnected successfully
PiperOrigin-RevId: 544683178
2023-06-30 09:58:09 -07:00
Anay Wadhera f05e24f7ea Plumb updateDiscoveryOptions into pcp handler.
PiperOrigin-RevId: 544431325
2023-06-29 12:33:16 -07:00
hai007 aca7ebf6a9 Clarify a log message
PiperOrigin-RevId: 544225952
2023-06-28 19:33:26 -07:00
hai007 6823b7105d Remove dead code.
PiperOrigin-RevId: 544209534
2023-06-28 17:51:06 -07:00
Anay Wadhera 1ddd4d91ea Check listening options when checking for bwu possibility
PiperOrigin-RevId: 543509150
2023-06-26 12:22:49 -07:00
Anay Wadhera c5c65714a0 Implement updateAdvertisingOptions
PiperOrigin-RevId: 543502031
2023-06-26 11:55:11 -07:00
Anay Wadhera 7f1d6a4bba Check listening options as well when we want to enforce topology constraints
PiperOrigin-RevId: 543497497
2023-06-26 11:40:17 -07:00
Guogang Li 86e39b004c Fixed the crash when handling keep alive packet
PiperOrigin-RevId: 542870226
2023-06-23 08:48:57 -07:00
Anay Wadhera da678f5b55 Adjust device provider registration API to match NP expectations
PiperOrigin-RevId: 542634789
2023-06-22 12:29:47 -07:00
Guogang Li 4e5d91b970 Fixed the crash when handling keep alive packet
PiperOrigin-RevId: 542592058
2023-06-22 10:05:46 -07:00
Anay Wadhera 5da4b33824 Revert "Revert incoming connections listener changes for internal breakages."
PiperOrigin-RevId: 542381558
2023-06-21 15:36:44 -07:00
Anay Wadhera 1973b09849 Revert incoming connections listener changes for internal breakages.
PiperOrigin-RevId: 542010849
2023-06-20 12:16:10 -07:00
Anay Wadhera b6a8802cb9 remove shared_ptr hack for std::function Runnable.
PiperOrigin-RevId: 541063821
2023-06-16 18:29:44 -07:00
Anay Wadhera 2a9bf7c883 Introduce connections authentication transport
PiperOrigin-RevId: 541057398
2023-06-16 17:55:06 -07:00
Anay Wadhera 44fb9b4fa2 implement stoplisteningforincomingconnections
PiperOrigin-RevId: 540724954
2023-06-15 16:43:56 -07:00
Anay Wadhera 5737b867ed implement startlisteningforincomingconnections
PiperOrigin-RevId: 540707703
2023-06-15 15:31:08 -07:00
Juliet Levesque aee56f0729 [Nearby Connections] Add CancellationFlag::Uncancel
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
2023-06-15 11:07:44 -07:00
hai007 ebe02e1174 Allow auto-resume the payload transfer when disconnection
PiperOrigin-RevId: 540438831
2023-06-14 18:35:04 -07:00
Anay Wadhera a25ef756e7 Isolate ble_v2/wifi_lan on incoming connection logic
PiperOrigin-RevId: 540420565
2023-06-14 17:02:25 -07:00
Anay Wadhera cf9170ba16 Isolate Ble accept handler logic
PiperOrigin-RevId: 540401997
2023-06-14 15:47:43 -07:00
Anay Wadhera 169087dc96 convert bluetooth connection handler to a front binder
PiperOrigin-RevId: 540355517
2023-06-14 13:00:33 -07:00