Bug 1338086 - Remove useless else blocks in order to reduce complexity in media/mtransport/ r=drno

MozReview-Commit-ID: 9Hvf7kGOi2s

--HG--
extra : rebase_source : d7a182a4b6fc02030f3e8d0eb5cbd75c0f5ff117
This commit is contained in:
Sylvestre Ledru 2017-02-14 15:08:29 +01:00
Родитель 5e2b99b016
Коммит 364ecfb0c7
3 изменённых файлов: 27 добавлений и 26 удалений

Просмотреть файл

@ -1141,7 +1141,8 @@ class IceTestPeer : public sigslot::has_slots<> {
DumpCandidatePair(pairs[p-1]);
DumpCandidatePair(pairs[p]);
return false;
} else if (priority == pairs[p].priority) {
}
if (priority == pairs[p].priority) {
if (!IceCandidatePairCompare()(pairs[p], pairs[p-1]) &&
!IceCandidatePairCompare()(pairs[p-1], pairs[p])) {
std::cerr << "Ignoring identical pair from trigger check" << std::endl;

Просмотреть файл

@ -143,9 +143,11 @@ TestNat::NatBehavior
TestNat::ToNatBehavior(const std::string& type) {
if (!type.compare("ENDPOINT_INDEPENDENT")) {
return TestNat::ENDPOINT_INDEPENDENT;
} else if (!type.compare("ADDRESS_DEPENDENT")) {
}
if (!type.compare("ADDRESS_DEPENDENT")) {
return TestNat::ADDRESS_DEPENDENT;
} else if (!type.compare("PORT_DEPENDENT")) {
}
if (!type.compare("PORT_DEPENDENT")) {
return TestNat::PORT_DEPENDENT;
}
@ -539,25 +541,23 @@ int TestNrSocket::write(const void *msg, size_t len, size_t *written) {
my_addr().as_string);
return internal_socket_->write(msg, len, written);
} else {
destroy_stale_port_mappings();
if (port_mappings_.empty()) {
r_log(LOG_GENERIC, LOG_DEBUG,
"TestNrSocket %s dropping outgoing TCP "
"because the port mapping was stale",
my_addr().as_string);
return R_INTERNAL;
}
// This is TCP only
MOZ_ASSERT(port_mappings_.size() == 1);
r_log(LOG_GENERIC, LOG_DEBUG,
"PortMapping %s -> %s writing",
port_mappings_.front()->external_socket_->my_addr().as_string,
port_mappings_.front()->remote_address_.as_string);
port_mappings_.front()->last_used_ = PR_IntervalNow();
return port_mappings_.front()->external_socket_->write(msg, len, written);
}
destroy_stale_port_mappings();
if (port_mappings_.empty()) {
r_log(LOG_GENERIC, LOG_DEBUG,
"TestNrSocket %s dropping outgoing TCP "
"because the port mapping was stale",
my_addr().as_string);
return R_INTERNAL;
}
// This is TCP only
MOZ_ASSERT(port_mappings_.size() == 1);
r_log(LOG_GENERIC, LOG_DEBUG,
"PortMapping %s -> %s writing",
port_mappings_.front()->external_socket_->my_addr().as_string,
port_mappings_.front()->remote_address_.as_string);
port_mappings_.front()->last_used_ = PR_IntervalNow();
return port_mappings_.front()->external_socket_->write(msg, len, written);
}
int TestNrSocket::read(void *buf, size_t maxlen, size_t *len) {
@ -642,7 +642,8 @@ int TestNrSocket::async_wait(int how, NR_async_cb cb, void *cb_arg,
this,
function,
line);
} else if (how == NR_ASYNC_WAIT_READ) {
}
if (how == NR_ASYNC_WAIT_READ) {
// For UDP port mappings, we decouple the writeable callbacks
for (PortMapping *port_mapping : port_mappings_) {
// Be ready to receive traffic on our port mappings
@ -903,7 +904,8 @@ int TestNrSocket::PortMapping::sendto(const void *msg,
r_log(LOG_GENERIC, LOG_DEBUG, "Enqueueing UDP packet to %s", to.as_string);
send_queue_.push_back(RefPtr<UdpPacket>(new UdpPacket(msg, len, to)));
return 0;
} else if (r) {
}
if (r) {
r_log(LOG_GENERIC,LOG_ERR, "Error: %d", r);
}

Просмотреть файл

@ -31,9 +31,7 @@ TransportLayerLogging::SendPacket(const unsigned char *data, size_t len) {
if (downward_) {
return downward_->SendPacket(data, len);
}
else {
return static_cast<TransportResult>(len);
}
return static_cast<TransportResult>(len);
}
void TransportLayerLogging::StateChange(TransportLayer *layer, State state) {