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

Side by Side Diff: webrtc/p2p/client/basicportallocator_unittest.cc

Issue 2171183002: Remove ports that are not used by any channel after timeout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 4 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
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 void OnPortReady(PortAllocatorSession* ses, PortInterface* port) { 410 void OnPortReady(PortAllocatorSession* ses, PortInterface* port) {
411 LOG(LS_INFO) << "OnPortReady: " << port->ToString(); 411 LOG(LS_INFO) << "OnPortReady: " << port->ToString();
412 ports_.push_back(port); 412 ports_.push_back(port);
413 // Make sure the new port is added to ReadyPorts. 413 // Make sure the new port is added to ReadyPorts.
414 auto ready_ports = ses->ReadyPorts(); 414 auto ready_ports = ses->ReadyPorts();
415 EXPECT_NE(ready_ports.end(), 415 EXPECT_NE(ready_ports.end(),
416 std::find(ready_ports.begin(), ready_ports.end(), port)); 416 std::find(ready_ports.begin(), ready_ports.end(), port));
417 } 417 }
418 void OnPortsPruned(PortAllocatorSession* ses, 418 void OnPortsPruned(PortAllocatorSession* ses,
419 const std::vector<PortInterface*>& ports_pruned) { 419 const std::vector<PortInterface*>& pruned_ports) {
420 LOG(LS_INFO) << "Number of ports pruned: " << ports_pruned.size(); 420 LOG(LS_INFO) << "Number of ports pruned: " << pruned_ports.size();
421 auto ready_ports = ses->ReadyPorts(); 421 auto ready_ports = ses->ReadyPorts();
422 auto new_end = ports_.end(); 422 auto new_end = ports_.end();
423 for (PortInterface* port : ports_pruned) { 423 for (PortInterface* port : pruned_ports) {
424 new_end = std::remove(ports_.begin(), new_end, port); 424 new_end = std::remove(ports_.begin(), new_end, port);
425 // Make sure the pruned port is not in ReadyPorts. 425 // Make sure the pruned port is not in ReadyPorts.
426 EXPECT_EQ(ready_ports.end(), 426 EXPECT_EQ(ready_ports.end(),
427 std::find(ready_ports.begin(), ready_ports.end(), port)); 427 std::find(ready_ports.begin(), ready_ports.end(), port));
428 } 428 }
429 ports_.erase(new_end, ports_.end()); 429 ports_.erase(new_end, ports_.end());
430 } 430 }
431 431
432 void OnCandidatesReady(PortAllocatorSession* ses, 432 void OnCandidatesReady(PortAllocatorSession* ses,
433 const std::vector<Candidate>& candidates) { 433 const std::vector<Candidate>& candidates) {
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 for (const Candidate& candidate : candidates) { 1713 for (const Candidate& candidate : candidates) {
1714 // Expect only relay candidates now that the filter is applied. 1714 // Expect only relay candidates now that the filter is applied.
1715 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); 1715 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type());
1716 // Expect that the raddr is emptied due to the CF_RELAY filter. 1716 // Expect that the raddr is emptied due to the CF_RELAY filter.
1717 EXPECT_EQ(candidate.related_address(), 1717 EXPECT_EQ(candidate.related_address(),
1718 rtc::EmptySocketAddressWithFamily(candidate.address().family())); 1718 rtc::EmptySocketAddressWithFamily(candidate.address().family()));
1719 } 1719 }
1720 } 1720 }
1721 1721
1722 } // namespace cricket 1722 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698