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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 new_remote_candidate.set_password(remote_ice()->pwd); | 778 new_remote_candidate.set_password(remote_ice()->pwd); |
779 } | 779 } |
780 } else { | 780 } else { |
781 // The candidate belongs to the next generation. Its pwd will be set | 781 // The candidate belongs to the next generation. Its pwd will be set |
782 // when the new remote ICE credentials arrive. | 782 // when the new remote ICE credentials arrive. |
783 LOG(LS_WARNING) << "A remote candidate arrives with an unknown ufrag: " | 783 LOG(LS_WARNING) << "A remote candidate arrives with an unknown ufrag: " |
784 << candidate.username(); | 784 << candidate.username(); |
785 } | 785 } |
786 } | 786 } |
787 | 787 |
| 788 // If this candidate matches what was thought to be a peer reflexive |
| 789 // candidate, we need to update the candidate priority/etc. |
| 790 for (Connection* conn : connections_) { |
| 791 conn->MaybeUpdatePeerReflexiveCandidate(new_remote_candidate); |
| 792 } |
| 793 |
788 // Create connections to this remote candidate. | 794 // Create connections to this remote candidate. |
789 CreateConnections(new_remote_candidate, NULL); | 795 CreateConnections(new_remote_candidate, NULL); |
790 | 796 |
791 // Resort the connections list, which may have new elements. | 797 // Resort the connections list, which may have new elements. |
792 SortConnections(); | 798 SortConnections(); |
793 } | 799 } |
794 | 800 |
795 void P2PTransportChannel::RemoveRemoteCandidate( | 801 void P2PTransportChannel::RemoveRemoteCandidate( |
796 const Candidate& cand_to_remove) { | 802 const Candidate& cand_to_remove) { |
797 auto iter = | 803 auto iter = |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 if (!connection) { | 882 if (!connection) { |
877 return false; | 883 return false; |
878 } | 884 } |
879 AddConnection(connection); | 885 AddConnection(connection); |
880 LOG_J(LS_INFO, this) << "Created connection with origin=" << origin << ", (" | 886 LOG_J(LS_INFO, this) << "Created connection with origin=" << origin << ", (" |
881 << connections_.size() << " total)"; | 887 << connections_.size() << " total)"; |
882 return true; | 888 return true; |
883 } | 889 } |
884 | 890 |
885 // No new connection was created. | 891 // No new connection was created. |
886 // Check if this is a peer reflexive candidate. | |
887 connection->MaybeUpdatePeerReflexiveCandidate(remote_candidate); | |
888 | |
889 // It is not legal to try to change any of the parameters of an existing | 892 // It is not legal to try to change any of the parameters of an existing |
890 // connection; however, the other side can send a duplicate candidate. | 893 // connection; however, the other side can send a duplicate candidate. |
891 if (!remote_candidate.IsEquivalent(connection->remote_candidate())) { | 894 if (!remote_candidate.IsEquivalent(connection->remote_candidate())) { |
892 LOG(INFO) << "Attempt to change a remote candidate." | 895 LOG(INFO) << "Attempt to change a remote candidate." |
893 << " Existing remote candidate: " | 896 << " Existing remote candidate: " |
894 << connection->remote_candidate().ToString() | 897 << connection->remote_candidate().ToString() |
895 << "New remote candidate: " << remote_candidate.ToString(); | 898 << "New remote candidate: " << remote_candidate.ToString(); |
896 } | 899 } |
897 return false; | 900 return false; |
898 } | 901 } |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 | 1696 |
1694 // During the initial state when nothing has been pinged yet, return the first | 1697 // During the initial state when nothing has been pinged yet, return the first |
1695 // one in the ordered |connections_|. | 1698 // one in the ordered |connections_|. |
1696 return *(std::find_if(connections_.begin(), connections_.end(), | 1699 return *(std::find_if(connections_.begin(), connections_.end(), |
1697 [conn1, conn2](Connection* conn) { | 1700 [conn1, conn2](Connection* conn) { |
1698 return conn == conn1 || conn == conn2; | 1701 return conn == conn1 || conn == conn2; |
1699 })); | 1702 })); |
1700 } | 1703 } |
1701 | 1704 |
1702 } // namespace cricket | 1705 } // namespace cricket |
OLD | NEW |