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

Side by Side Diff: webrtc/base/network.cc

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 if (merged_list.size() != networks_.size()) { 310 if (merged_list.size() != networks_.size()) {
311 *changed = true; 311 *changed = true;
312 } 312 }
313 313
314 // If the network list changes, we re-assign |networks_| to the merged list 314 // If the network list changes, we re-assign |networks_| to the merged list
315 // and re-sort it. 315 // and re-sort it.
316 if (*changed) { 316 if (*changed) {
317 networks_ = merged_list; 317 networks_ = merged_list;
318 // Reset the active states of all networks. 318 // Reset the active states of all networks.
319 for (const auto& kv : networks_map_) { 319 for (const auto& kv : networks_map_) {
320 kv.second->set_active(false); 320 Network* network = kv.second;
321 } 321 // If |network| is in the newly generated |networks_|, it is active.
322 for (Network* network : networks_) { 322 bool found = std::find(networks_.begin(), networks_.end(), network) !=
323 network->set_active(true); 323 networks_.end();
324 network->set_active(found);
324 } 325 }
325 std::sort(networks_.begin(), networks_.end(), SortNetworks); 326 std::sort(networks_.begin(), networks_.end(), SortNetworks);
326 // Now network interfaces are sorted, we should set the preference value 327 // Now network interfaces are sorted, we should set the preference value
327 // for each of the interfaces we are planning to use. 328 // for each of the interfaces we are planning to use.
328 // Preference order of network interfaces might have changed from previous 329 // Preference order of network interfaces might have changed from previous
329 // sorting due to addition of higher preference network interface. 330 // sorting due to addition of higher preference network interface.
330 // Since we have already sorted the network interfaces based on our 331 // Since we have already sorted the network interfaces based on our
331 // requirements, we will just assign a preference value starting with 127, 332 // requirements, we will just assign a preference value starting with 127,
332 // in decreasing order. 333 // in decreasing order.
333 int pref = kHighestNetworkPreference; 334 int pref = kHighestNetworkPreference;
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 std::stringstream ss; 917 std::stringstream ss;
917 // Print out the first space-terminated token of the network desc, plus 918 // Print out the first space-terminated token of the network desc, plus
918 // the IP address. 919 // the IP address.
919 ss << "Net[" << description_.substr(0, description_.find(' ')) 920 ss << "Net[" << description_.substr(0, description_.find(' '))
920 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ 921 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_
921 << ":" << AdapterTypeToString(type_) << "]"; 922 << ":" << AdapterTypeToString(type_) << "]";
922 return ss.str(); 923 return ss.str();
923 } 924 }
924 925
925 } // namespace rtc 926 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698