Commit Graph
380 Commits
Author SHA1 Message Date
Anay Wadhera 2c4bf0471f change connections v3 API surface to use the new advertising/discovery options
PiperOrigin-RevId: 559300673
2023-08-22 20:38:28 -07:00
Guogang Li ea7aa00e0c Avoid reading GATT server for same advertisement
PiperOrigin-RevId: 558944228
2023-08-21 17:24:03 -07:00
Janusz Sobczak e38ce96964 Replace AcceptedConnectionCallback structs with absl::AnyInvocable
PiperOrigin-RevId: 557949490
2023-08-17 15:14:25 -07:00
Janusz Sobczak 55194622a7 Migrate to AnyInvocable
PiperOrigin-RevId: 557660146
2023-08-16 18:13:11 -07:00
Janusz Sobczak ec139d1e8b Replace std::function with AnyInvocable
Also refactored the callbacks to make sure that we call either on_success or on_failure callback, and only once.

PiperOrigin-RevId: 557299838
2023-08-15 17:20:30 -07:00
Janusz Sobczak 2c55c0cdbd Refactor Pipe implementation
* Remove Pipe classes
* Rename BasePipe to Pipe
* Hide Pipe class in anonymous namespace in pipe.cc
* Add CreatePipe static method
* Replace Payload(std::function<InputStream&()>) with Payload(std::unique_ptr<InputStream>)
* Find&Replace Pipe usages

PiperOrigin-RevId: 557276980
2023-08-15 15:53:58 -07:00
hai007 eb4a37084b Support dynamic upgrade when the device is connected to Wifi AP after initial connection.
PiperOrigin-RevId: 556959762
2023-08-14 17:25:59 -07:00
Janusz Sobczak 8ccb9fcfec Replace std::function with AnyInvocable
PiperOrigin-RevId: 556090653
2023-08-11 14:27:08 -07:00
Janusz Sobczak cce7cf59b9 Replace std::function with AnyInvocable
PiperOrigin-RevId: 555650115
2023-08-10 14:17:31 -07:00
Suet-Fei Li 5589166b3b Update copyright year.
PiperOrigin-RevId: 555341312
2023-08-09 19:14:36 -07:00
Janusz Sobczak e703b21cde Fix connections_test
PiperOrigin-RevId: 555282324
2023-08-09 19:13:52 -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
hai007 3a88f4e217 record connection layer status code
PiperOrigin-RevId: 553302833
2023-08-09 19:06:13 -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
Anay Wadhera 8cfbc884d7 introduce v3 discovery options
PiperOrigin-RevId: 551053578
2023-07-25 18:15:16 -07:00
Anay Wadhera 9c6b60df3f introduce v3 advertising options
PiperOrigin-RevId: 551051166
2023-07-25 18:05:08 -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
Crisrael Lucero 0e44ed626d Refactor crypto/ directory into crypto_cros/ and crypto/
PiperOrigin-RevId: 549467911
2023-07-19 17:12:52 -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 2dcfe66f2e update device provider api for multi-identity auth
PiperOrigin-RevId: 548767413
2023-07-17 12:30:34 -07:00
Anay Wadhera bc68a6d71c Implement updateDiscoveryOptions in pcp handler.
PiperOrigin-RevId: 548177687
2023-07-14 11:30:08 -07:00
Nick Bourdakos 99de15aef5 Delete deprecated connections/clients/ios package
PiperOrigin-RevId: 547960446
2023-07-13 16:29:49 -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
Crisrael Lucero 001069faa1 Convert std::variant usage to absl::variant
PiperOrigin-RevId: 546987633
2023-07-10 14:43:27 -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 507935f506 Implement NearbyDevice::ToProto() for Connections device
PiperOrigin-RevId: 546376155
2023-07-07 13:55:31 -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