OLD | NEW |
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 Loading... |
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 // Network may not guarantee the order of the candidate delivery. If a |
| 671 // remote candidate with an older generation arrives, drop it. |
| 672 if (generation != 0 && generation < remote_candidate_generation_) { |
| 673 LOG(LS_WARNING) << "Dropping a remote candidate because its generation " |
| 674 << generation |
| 675 << " is lower than the current remote generation " |
| 676 << remote_candidate_generation_; |
| 677 return; |
| 678 } |
| 679 |
669 // Create connections to this remote candidate. | 680 // Create connections to this remote candidate. |
670 CreateConnections(candidate, NULL, false); | 681 CreateConnections(candidate, NULL, false); |
671 | 682 |
672 // Resort the connections list, which may have new elements. | 683 // Resort the connections list, which may have new elements. |
673 SortConnections(); | 684 SortConnections(); |
674 } | 685 } |
675 | 686 |
676 // Creates connections from all of the ports that we care about to the given | 687 // 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 | 688 // remote candidate. The return value is true if we created a connection from |
678 // the origin port. | 689 // the origin port. |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 SignalReadPacket(this, data, len, packet_time, 0); | 1419 SignalReadPacket(this, data, len, packet_time, 0); |
1409 } | 1420 } |
1410 | 1421 |
1411 void P2PTransportChannel::OnReadyToSend(Connection* connection) { | 1422 void P2PTransportChannel::OnReadyToSend(Connection* connection) { |
1412 if (connection == best_connection_ && writable()) { | 1423 if (connection == best_connection_ && writable()) { |
1413 SignalReadyToSend(this); | 1424 SignalReadyToSend(this); |
1414 } | 1425 } |
1415 } | 1426 } |
1416 | 1427 |
1417 } // namespace cricket | 1428 } // namespace cricket |
OLD | NEW |