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

Side by Side Diff: webrtc/p2p/base/stunport.cc

Issue 1998813002: Fixing the behavior of the candidate filter with pooled candidates. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 // If socket is shared and |stun_reflected_addr| is equal to local socket 451 // If socket is shared and |stun_reflected_addr| is equal to local socket
452 // address, or if the same address has been added by another STUN server, 452 // address, or if the same address has been added by another STUN server,
453 // then discarding the stun address. 453 // then discarding the stun address.
454 // For STUN, related address is the local socket address. 454 // For STUN, related address is the local socket address.
455 if ((!SharedSocket() || stun_reflected_addr != socket_->GetLocalAddress()) && 455 if ((!SharedSocket() || stun_reflected_addr != socket_->GetLocalAddress()) &&
456 !HasCandidateWithAddress(stun_reflected_addr)) { 456 !HasCandidateWithAddress(stun_reflected_addr)) {
457 457
458 rtc::SocketAddress related_address = socket_->GetLocalAddress(); 458 rtc::SocketAddress related_address = socket_->GetLocalAddress();
459 // If we can't stamp the related address correctly, empty it to avoid leak. 459 // If we can't stamp the related address correctly, empty it to avoid leak.
460 if (!MaybeSetDefaultLocalAddress(&related_address) || 460 if (!MaybeSetDefaultLocalAddress(&related_address)) {
461 !(candidate_filter() & CF_HOST)) {
462 // If candidate filter doesn't have CF_HOST specified, empty raddr to
463 // avoid local address leakage.
464 related_address = rtc::EmptySocketAddressWithFamily( 461 related_address = rtc::EmptySocketAddressWithFamily(
465 related_address.family()); 462 related_address.family());
466 } 463 }
467 464
468 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), related_address, 465 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), related_address,
469 UDP_PROTOCOL_NAME, "", "", STUN_PORT_TYPE, 466 UDP_PROTOCOL_NAME, "", "", STUN_PORT_TYPE,
470 ICE_TYPE_PREFERENCE_SRFLX, 0, false); 467 ICE_TYPE_PREFERENCE_SRFLX, 0, false);
471 } 468 }
472 MaybeSetPortCompleteOrError(); 469 MaybeSetPortCompleteOrError();
473 } 470 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 const std::vector<Candidate>& existing_candidates = Candidates(); 516 const std::vector<Candidate>& existing_candidates = Candidates();
520 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); 517 std::vector<Candidate>::const_iterator it = existing_candidates.begin();
521 for (; it != existing_candidates.end(); ++it) { 518 for (; it != existing_candidates.end(); ++it) {
522 if (it->address() == addr) 519 if (it->address() == addr)
523 return true; 520 return true;
524 } 521 }
525 return false; 522 return false;
526 } 523 }
527 524
528 } // namespace cricket 525 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698