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

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

Issue 1248063002: Fix the generation mismatch assertion error. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 5 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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } else { 659 } else {
660 LOG(LS_INFO) << "Not switching the best connection on controlled side yet," 660 LOG(LS_INFO) << "Not switching the best connection on controlled side yet,"
661 << " because it's not writable: " << conn->ToString(); 661 << " because it's not writable: " << conn->ToString();
662 pending_best_connection_ = conn; 662 pending_best_connection_ = conn;
663 } 663 }
664 } 664 }
665 665
666 void P2PTransportChannel::OnCandidate(const Candidate& candidate) { 666 void P2PTransportChannel::OnCandidate(const Candidate& candidate) {
667 ASSERT(worker_thread_ == rtc::Thread::Current()); 667 ASSERT(worker_thread_ == rtc::Thread::Current());
668 668
669 uint32 generation = candidate.generation();
670 if (generation != 0 && generation < remote_candidate_generation_) {
671 LOG(LS_WARNING) << "Dropping a remote candidate because its generation "
672 << generation
673 << " is lower than the current remote generation "
674 << remote_candidate_generation_;
675 return;
676 }
677
669 // Create connections to this remote candidate. 678 // Create connections to this remote candidate.
670 CreateConnections(candidate, NULL, false); 679 CreateConnections(candidate, NULL, false);
671 680
672 // Resort the connections list, which may have new elements. 681 // Resort the connections list, which may have new elements.
673 SortConnections(); 682 SortConnections();
674 } 683 }
675 684
676 // Creates connections from all of the ports that we care about to the given 685 // Creates connections from all of the ports that we care about to the given
677 // remote candidate. The return value is true if we created a connection from 686 // remote candidate. The return value is true if we created a connection from
678 // the origin port. 687 // the origin port.
679 bool P2PTransportChannel::CreateConnections(const Candidate& remote_candidate, 688 bool P2PTransportChannel::CreateConnections(const Candidate& remote_candidate,
680 PortInterface* origin_port, 689 PortInterface* origin_port,
681 bool readable) { 690 bool readable) {
682 ASSERT(worker_thread_ == rtc::Thread::Current()); 691 ASSERT(worker_thread_ == rtc::Thread::Current());
683 692
684 Candidate new_remote_candidate(remote_candidate); 693 Candidate new_remote_candidate(remote_candidate);
pthatcher1 2015/07/29 21:09:42 Can you move the generation check down here and re
honghaiz3 2015/07/30 17:16:16 If we move it down here, it means that even if it
685 new_remote_candidate.set_generation( 694 new_remote_candidate.set_generation(
686 GetRemoteCandidateGeneration(remote_candidate)); 695 GetRemoteCandidateGeneration(remote_candidate));
687 // ICE candidates don't need to have username and password set, but 696 // ICE candidates don't need to have username and password set, but
688 // the code below this (specifically, ConnectionRequest::Prepare in 697 // the code below this (specifically, ConnectionRequest::Prepare in
689 // port.cc) uses the remote candidates's username. So, we set it 698 // port.cc) uses the remote candidates's username. So, we set it
690 // here. 699 // here.
691 if (remote_candidate.username().empty()) { 700 if (remote_candidate.username().empty()) {
692 new_remote_candidate.set_username(remote_ice_ufrag_); 701 new_remote_candidate.set_username(remote_ice_ufrag_);
693 } 702 }
694 if (remote_candidate.password().empty()) { 703 if (remote_candidate.password().empty()) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 SignalReadPacket(this, data, len, packet_time, 0); 1417 SignalReadPacket(this, data, len, packet_time, 0);
1409 } 1418 }
1410 1419
1411 void P2PTransportChannel::OnReadyToSend(Connection* connection) { 1420 void P2PTransportChannel::OnReadyToSend(Connection* connection) {
1412 if (connection == best_connection_ && writable()) { 1421 if (connection == best_connection_ && writable()) {
1413 SignalReadyToSend(this); 1422 SignalReadyToSend(this);
1414 } 1423 }
1415 } 1424 }
1416 1425
1417 } // namespace cricket 1426 } // namespace cricket
OLDNEW
« talk/app/webrtc/webrtcsession.cc ('K') | « talk/app/webrtc/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698