I'm having a confusing issue where I cannot see the change to net/socket/tcp_client_socket.cc even though I know there must be one. Maybe a Gerrit bug? Here's a couple of comments to be going along with.
/* socket_performance_watcher= */ nullptr,Nit, no need to fix: the style doesn't actually include spaces, so
```suggestion
/*socket_performance_watcher=*/ nullptr,
```
https://google.github.io/styleguide/cppguide.html#Function_Argument_Comments (can't find a better reference right now)
You will need to modify the type of CacheKey when you rebase this.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
I'm having a confusing issue where I cannot see the change to net/socket/tcp_client_socket.cc even though I know there must be one. Maybe a Gerrit bug? Here's a couple of comments to be going along with.
I'm relying on the pre-existing code in [TCPClientSocket](https://source.chromium.org/chromium/chromium/src/+/main:net/socket/tcp_client_socket.h;l=65;drc=a8be8b790f49830fbd8ee5edc7c72ba45f3d1e21) and [UDPClientSocket](https://source.chromium.org/chromium/chromium/src/+/main:net/socket/udp_client_socket.h;l=31;drc=a8be8b790f49830fbd8ee5edc7c72ba45f3d1e21)
Nit, no need to fix: the style doesn't actually include spaces, so
```suggestion
/*socket_performance_watcher=*/ nullptr,
```https://google.github.io/styleguide/cppguide.html#Function_Argument_Comments (can't find a better reference right now)
You will need to modify the type of CacheKey when you rebase this.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm, wow, thanks for the extra AddressSorterPosix unit tests! I obviously didn't look hard enough for a way to test the caching in isolation.
You will need to modify the type of CacheKey when you rebase this.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Andrew, could you Owners-Override the mechanical changes in chrome/ and components/? This CL is changing a socket-related API in //net.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Owners-Override | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
42 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: net/dns/address_sorter_posix_unittest.cc
Insertions: 9, Deletions: 12.
@@ -816,12 +816,11 @@
TEST_F(AddressSorterPosixCacheTest, StatePartitioningByTargetNetwork) {
size_t socket_create_count = 0;
- raw_ptr<TestUDPClientSocket> last_created_socket = nullptr;
- SetSocketCreateCallback(
- base::BindLambdaForTesting([&socket_create_count, &last_created_socket](
- TestUDPClientSocket* socket) {
+ handles::NetworkHandle last_bound_network = handles::kInvalidNetworkHandle;
+ SetSocketCreateCallback(base::BindLambdaForTesting(
+ [&socket_create_count, &last_bound_network](TestUDPClientSocket* socket) {
socket_create_count++;
- last_created_socket = socket;
+ last_bound_network = socket->GetBoundNetwork();
}));
AddMapping("10.0.0.1", "10.0.0.10");
@@ -838,14 +837,13 @@
callback.callback()));
callback.WaitForResult();
EXPECT_EQ(socket_create_count, 1u);
- ASSERT_TRUE(last_created_socket);
- EXPECT_EQ(last_created_socket->GetBoundNetwork(), network_a);
+ EXPECT_EQ(last_bound_network, network_a);
}
// Second sort with network_b should miss cache.
{
socket_create_count = 0;
- last_created_socket = nullptr;
+ last_bound_network = handles::kInvalidNetworkHandle;
std::vector<IPEndPoint> sorted;
TestCompletionCallback callback;
sorter_->Sort({endpoint}, NetworkAnonymizationKey(), network_b,
@@ -853,14 +851,13 @@
callback.callback()));
callback.WaitForResult();
EXPECT_EQ(socket_create_count, 1u);
- ASSERT_TRUE(last_created_socket);
- EXPECT_EQ(last_created_socket->GetBoundNetwork(), network_b);
+ EXPECT_EQ(last_bound_network, network_b);
}
// Third sort with network_a should hit cache.
{
socket_create_count = 0;
- last_created_socket = nullptr;
+ last_bound_network = handles::kInvalidNetworkHandle;
std::vector<IPEndPoint> sorted;
TestCompletionCallback callback;
sorter_->Sort({endpoint}, NetworkAnonymizationKey(), network_a,
@@ -868,7 +865,7 @@
callback.callback()));
callback.WaitForResult();
EXPECT_EQ(socket_create_count, 0u);
- EXPECT_FALSE(last_created_socket);
+ EXPECT_EQ(last_bound_network, handles::kInvalidNetworkHandle);
}
}
```
```
The name of the file: net/dns/host_resolver_manager.h
Insertions: 1, Deletions: 1.
@@ -492,7 +492,7 @@
// ERR_IO_PENDING if it will be asynchronous.
virtual int StartGloballyReachableCheck(
const IPAddress& dest,
- handles::NetworkHandle network,
+ handles::NetworkHandle target_network,
const NetLogWithSource& net_log,
ClientSocketFactory* client_socket_factory,
CompletionOnceCallback callback);
```
```
The name of the file: net/quic/quic_session_pool.h
Insertions: 1, Deletions: 2.
@@ -698,10 +698,9 @@
MultiplexedSessionCreationInitiator session_creation_initiator,
std::optional<ConnectionManagementConfig> connection_management_config,
int rv);
- base::expected<QuicSessionAttempt::CreateSessionResult, int>
-
// TODO(crbug.com/518753285): Stop accepting a `network` parameter. Instead,
// rely on socket being already bound to the correct network.
+ base::expected<QuicSessionAttempt::CreateSessionResult, int>
CreateSessionHelper(
QuicSessionAliasKey key,
quic::ParsedQuicVersion quic_version,
```
```
The name of the file: net/socket/tcp_client_socket.h
Insertions: 1, Deletions: 1.
@@ -64,7 +64,7 @@
NetworkQualityEstimator* network_quality_estimator,
net::NetLog* net_log,
const net::NetLogSource& source,
- handles::NetworkHandle target_network);
+ handles::NetworkHandle network);
// Adopts the given, connected socket and then acts as if Connect() had been
// called. This function is used by TCPServerSocket and for testing.
```
Support target_network in ClientSocketFactory and related classes
This CL performs the last bit of plumbing necessary to perform
multi-networking in Chrome. More precisely, it:
1. Adds target_network to the ClientSocketFactory interface. This is
then just passed onto the pre-existing multi-networking code at the
socket layer (the one used by Cronet and multi-network CCT).
2. Updates calls into ClientSocketFactory (and sockets directly) to
pass a proper target network. This is usually fetched from some
key (be it a SpdySessionKey, QuicSessionKey, or DNS's JobKey)
3. Documents as not supported (for now), the network service APIs that
directly interact with sockets, bypassing URLLoaderFactories.
Two pieces of code are particularly tricky and will be fixed further
separately:
1. QUIC's handling of sockets. When connection migration is enabled,
QUIC sockets get already bound to a network. The way this is
currently performed does not match how multi-networking binds its
socket. Follow-up CLs will refactor connection's migration network
binding and disable connection migration for connections bound to
a network.
This is tracked at https://crbug.com/518753285.
2. IPv6 connectivity checks. The "cache" within HostResolverManager
needs to become partitioned by network.
This is tracked at https://crbug.com/519138300.
As per testing, this covers the following:
1. Behavior of IPv6 connectivity checks when targeting a network and not
2. AddressSorter correctly receiving and propagating the target network
3. ClientSocketPool correctly partitioning by target network
Note: this does not need to modify the actual socket's code, we can just
rely on the previous multi-network work done for Cronet.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |