| Index: webrtc/p2p/base/transport.cc
|
| diff --git a/webrtc/p2p/base/transport.cc b/webrtc/p2p/base/transport.cc
|
| index bac695d6b3d0c5b44486b32902171e570fa6404f..2e09047ee1403fa845a3514b9bf8ac29359981de 100644
|
| --- a/webrtc/p2p/base/transport.cc
|
| +++ b/webrtc/p2p/base/transport.cc
|
| @@ -294,6 +294,22 @@ bool Transport::VerifyCandidate(const Candidate& cand, std::string* error) {
|
| }
|
| }
|
|
|
| + if (!HasChannel(cand.component())) {
|
| + *error = "Candidate has an unknown component: " + cand.ToString() +
|
| + " for content: " + name();
|
| + return false;
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +bool Transport::VerifyCandidates(const Candidates& candidates,
|
| + std::string* error) {
|
| + for (const Candidate& candidate : candidates) {
|
| + if (!VerifyCandidate(candidate, error)) {
|
| + return false;
|
| + }
|
| + }
|
| return true;
|
| }
|
|
|
| @@ -319,15 +335,8 @@ bool Transport::AddRemoteCandidates(const std::vector<Candidate>& candidates,
|
| std::string* error) {
|
| ASSERT(!channels_destroyed_);
|
| // Verify each candidate before passing down to transport layer.
|
| - for (const Candidate& cand : candidates) {
|
| - if (!VerifyCandidate(cand, error)) {
|
| - return false;
|
| - }
|
| - if (!HasChannel(cand.component())) {
|
| - *error = "Candidate has unknown component: " + cand.ToString() +
|
| - " for content: " + name();
|
| - return false;
|
| - }
|
| + if (!VerifyCandidates(candidates, error)) {
|
| + return false;
|
| }
|
|
|
| for (const Candidate& candidate : candidates) {
|
| @@ -339,6 +348,23 @@ bool Transport::AddRemoteCandidates(const std::vector<Candidate>& candidates,
|
| return true;
|
| }
|
|
|
| +bool Transport::RemoveRemoteCandidates(const std::vector<Candidate>& candidates,
|
| + std::string* error) {
|
| + ASSERT(!channels_destroyed_);
|
| + // Verify each candidate before passing down to transport layer.
|
| + if (!VerifyCandidates(candidates, error)) {
|
| + return false;
|
| + }
|
| +
|
| + for (const Candidate& candidate : candidates) {
|
| + TransportChannelImpl* channel = GetChannel(candidate.component());
|
| + if (channel != nullptr) {
|
| + channel->RemoveRemoteCandidate(candidate);
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| bool Transport::ApplyLocalTransportDescription(TransportChannelImpl* ch,
|
| std::string* error_desc) {
|
| ch->SetIceCredentials(local_description_->ice_ufrag,
|
|
|