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

Unified Diff: p2p/client/basicportallocator.cc

Issue 3018483002: Remove BasicPortAllocator::EnableProtocol. (Closed)
Patch Set: Rebase onto master Created 3 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « p2p/client/basicportallocator.h ('k') | p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: p2p/client/basicportallocator.cc
diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc
index 32941f34677d8cd65a3c8b7573a256ba355cc38a..e00638032734ea2b1e36ad33cb0b9d534eb4d830 100644
--- a/p2p/client/basicportallocator.cc
+++ b/p2p/client/basicportallocator.cc
@@ -43,9 +43,8 @@ enum {
const int PHASE_UDP = 0;
const int PHASE_RELAY = 1;
const int PHASE_TCP = 2;
-const int PHASE_SSLTCP = 3;
-const int kNumPhases = 4;
+const int kNumPhases = 3;
// Gets protocol priority: UDP > TCP > SSLTCP == TLS.
int GetProtocolPriority(cricket::ProtocolType protocol) {
@@ -408,11 +407,6 @@ void BasicPortAllocatorSession::GetCandidatesFromPort(
if (!CheckCandidateFilter(candidate)) {
continue;
}
- ProtocolType pvalue;
- if (!StringToProto(candidate.protocol().c_str(), &pvalue) ||
- !data.sequence()->ProtocolEnabled(pvalue)) {
- continue;
- }
candidates->push_back(SanitizeRelatedAddress(candidate));
}
}
@@ -817,18 +811,10 @@ void BasicPortAllocatorSession::OnCandidateReady(
}
}
- ProtocolType pvalue;
- bool candidate_protocol_enabled =
- StringToProto(c.protocol().c_str(), &pvalue) &&
- data->sequence()->ProtocolEnabled(pvalue);
-
- if (data->ready() && CheckCandidateFilter(c) && candidate_protocol_enabled) {
+ if (data->ready() && CheckCandidateFilter(c)) {
std::vector<Candidate> candidates;
candidates.push_back(SanitizeRelatedAddress(c));
SignalCandidatesReady(this, candidates);
- } else if (!candidate_protocol_enabled) {
- LOG(LS_INFO)
- << "Not yet signaling candidate because protocol is not yet enabled.";
} else {
LOG(LS_INFO) << "Discarding candidate because it doesn't match filter.";
}
@@ -925,36 +911,6 @@ void BasicPortAllocatorSession::OnPortError(Port* port) {
MaybeSignalCandidatesAllocationDone();
}
-void BasicPortAllocatorSession::OnProtocolEnabled(AllocationSequence* seq,
- ProtocolType proto) {
- std::vector<Candidate> candidates;
- for (std::vector<PortData>::iterator it = ports_.begin();
- it != ports_.end(); ++it) {
- if (it->sequence() != seq)
- continue;
-
- const std::vector<Candidate>& potentials = it->port()->Candidates();
- for (size_t i = 0; i < potentials.size(); ++i) {
- if (!CheckCandidateFilter(potentials[i])) {
- continue;
- }
- ProtocolType pvalue;
- bool candidate_protocol_enabled =
- StringToProto(potentials[i].protocol().c_str(), &pvalue) &&
- pvalue == proto;
- if (candidate_protocol_enabled) {
- LOG(LS_INFO) << "Signaling candidate because protocol was enabled: "
- << potentials[i].ToSensitiveString();
- candidates.push_back(potentials[i]);
- }
- }
- }
-
- if (!candidates.empty()) {
- SignalCandidatesReady(this, candidates);
- }
-}
-
bool BasicPortAllocatorSession::CheckCandidateFilter(const Candidate& c) const {
uint32_t filter = candidate_filter_;
@@ -1189,9 +1145,7 @@ void AllocationSequence::OnMessage(rtc::Message* msg) {
RTC_DCHECK(rtc::Thread::Current() == session_->network_thread());
RTC_DCHECK(msg->message_id == MSG_ALLOCATION_PHASE);
- const char* const PHASE_NAMES[kNumPhases] = {
- "Udp", "Relay", "Tcp", "SslTcp"
- };
+ const char* const PHASE_NAMES[kNumPhases] = {"Udp", "Relay", "Tcp"};
// Perform all of the phases in the current step.
LOG_J(LS_INFO, network_) << "Allocation Phase="
@@ -1201,7 +1155,6 @@ void AllocationSequence::OnMessage(rtc::Message* msg) {
case PHASE_UDP:
CreateUDPPorts();
CreateStunPorts();
- EnableProtocol(PROTO_UDP);
break;
case PHASE_RELAY:
@@ -1210,12 +1163,7 @@ void AllocationSequence::OnMessage(rtc::Message* msg) {
case PHASE_TCP:
CreateTCPPorts();
- EnableProtocol(PROTO_TCP);
- break;
-
- case PHASE_SSLTCP:
state_ = kCompleted;
- EnableProtocol(PROTO_SSLTCP);
break;
default:
@@ -1235,22 +1183,6 @@ void AllocationSequence::OnMessage(rtc::Message* msg) {
}
}
-void AllocationSequence::EnableProtocol(ProtocolType proto) {
- if (!ProtocolEnabled(proto)) {
- protocols_.push_back(proto);
- session_->OnProtocolEnabled(this, proto);
- }
-}
-
-bool AllocationSequence::ProtocolEnabled(ProtocolType proto) const {
- for (ProtocolList::const_iterator it = protocols_.begin();
- it != protocols_.end(); ++it) {
- if (*it == proto)
- return true;
- }
- return false;
-}
-
void AllocationSequence::CreateUDPPorts() {
if (IsFlagSet(PORTALLOCATOR_DISABLE_UDP)) {
LOG(LS_VERBOSE) << "AllocationSequence: UDP ports disabled, skipping.";
« no previous file with comments | « p2p/client/basicportallocator.h ('k') | p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698