Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: content/renderer/p2p/ipc_network_manager.cc

Issue 536133003: MergeNetworkList can't group address under the same interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix one more comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/p2p/ipc_network_manager.cc
diff --git a/content/renderer/p2p/ipc_network_manager.cc b/content/renderer/p2p/ipc_network_manager.cc
index 8995339cb58796abb7447c0cdbcc03ab2079e3be..753573404d2d2f325201712433e13e3969f95c96 100644
--- a/content/renderer/p2p/ipc_network_manager.cc
+++ b/content/renderer/p2p/ipc_network_manager.cc
@@ -35,7 +35,8 @@ rtc::AdapterType ConvertConnectionTypeToAdapterType(
} // namespace
-IpcNetworkManager::IpcNetworkManager(P2PSocketDispatcher* socket_dispatcher)
+IpcNetworkManager::IpcNetworkManager(
+ NetworkListManager* socket_dispatcher)
: socket_dispatcher_(socket_dispatcher),
start_count_(0),
network_list_received_(false),
@@ -71,8 +72,6 @@ void IpcNetworkManager::OnNetworkListChanged(
if (!network_list_received_)
network_list_received_ = true;
- // Note: 32 and 64 are the arbitrary(kind of) prefix length used to
- // differentiate IPv4 and IPv6 addresses.
// rtc::Network uses these prefix_length to compare network
// interfaces discovered.
std::vector<rtc::Network*> networks;
@@ -84,8 +83,10 @@ void IpcNetworkManager::OnNetworkListChanged(
uint32 address;
memcpy(&address, &it->address[0], sizeof(uint32));
address = rtc::NetworkToHost32(address);
+ rtc::IPAddress prefix = rtc::TruncateIP(rtc::IPAddress(address),
+ it->network_prefix);
rtc::Network* network = new rtc::Network(
- it->name, it->name, rtc::IPAddress(address), 32,
+ it->name, it->name, prefix, it->network_prefix,
ConvertConnectionTypeToAdapterType(it->type));
network->AddIP(rtc::IPAddress(address));
networks.push_back(network);
@@ -95,8 +96,10 @@ void IpcNetworkManager::OnNetworkListChanged(
memcpy(&address, &it->address[0], sizeof(in6_addr));
rtc::IPAddress ip6_addr(address);
if (!rtc::IPIsPrivate(ip6_addr)) {
+ rtc::IPAddress prefix = rtc::TruncateIP(rtc::IPAddress(ip6_addr),
+ it->network_prefix);
rtc::Network* network = new rtc::Network(
- it->name, it->name, ip6_addr, 64,
+ it->name, it->name, prefix, it->network_prefix,
ConvertConnectionTypeToAdapterType(it->type));
network->AddIP(ip6_addr);
networks.push_back(network);

Powered by Google App Engine
This is Rietveld 408576698