Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index e7788e733ad4866e1f35a8949603673e70c9a06f..431f45c24d1c7e4a6d964b62a4202a36ab58870b 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -732,6 +732,19 @@ void P2PTransportChannel::AddRemoteCandidate(const Candidate& candidate) { |
SortConnections(); |
} |
+void P2PTransportChannel::RemoveRemoteCandidate( |
+ const Candidate& cand_to_remove) { |
+ auto iter = |
+ std::remove_if(remote_candidates_.begin(), remote_candidates_.end(), |
+ [cand_to_remove](const Candidate& candidate) { |
+ return cand_to_remove.MatchesForRemoval(candidate); |
+ }); |
+ if (iter != remote_candidates_.end()) { |
+ LOG(LS_VERBOSE) << "Removed remote candidate " << cand_to_remove.ToString(); |
+ remote_candidates_.erase(iter, remote_candidates_.end()); |
+ } |
+} |
+ |
// Creates connections from all of the ports that we care about to the given |
// remote candidate. The return value is true if we created a connection from |
// the origin port. |
@@ -1437,7 +1450,9 @@ void P2PTransportChannel::OnPortNetworkInactive(PortInterface* port) { |
ports_.erase(it); |
LOG(INFO) << "Removed port due to inactive networks: " << ports_.size() |
<< " remaining"; |
- // TODO(honghaiz): Signal candidate removals to the remote side. |
+ // Make a copy of the candidates in case the original ones are removed. |
+ std::vector<Candidate> candidates = port->Candidates(); |
+ SignalCandidatesRemoved(this, candidates); |
} |
// We data is available, let listeners know |