Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index ee9906053cd772766821e491b4a42c826a211a78..8c577aff7794f7a68f33b01ff79545d6ed03fc3d 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -33,13 +33,15 @@ enum { |
// we don't want to degrade the quality on a modem. These numbers should work |
// well on a 28.8K modem, which is the slowest connection on which the voice |
// quality is reasonable at all. |
-static const uint32 PING_PACKET_SIZE = 60 * 8; |
-static const uint32 WRITABLE_DELAY = 1000 * PING_PACKET_SIZE / 1000; // 480ms |
-static const uint32 UNWRITABLE_DELAY = 1000 * PING_PACKET_SIZE / 10000; // 50ms |
+static const uint32_t PING_PACKET_SIZE = 60 * 8; |
+static const uint32_t WRITABLE_DELAY = 1000 * PING_PACKET_SIZE / 1000; // 480ms |
+static const uint32_t UNWRITABLE_DELAY = |
+ 1000 * PING_PACKET_SIZE / 10000; // 50ms |
// If there is a current writable connection, then we will also try hard to |
// make sure it is pinged at this rate. |
-static const uint32 MAX_CURRENT_WRITABLE_DELAY = 900; // 2*WRITABLE_DELAY - bit |
+static const uint32_t MAX_CURRENT_WRITABLE_DELAY = |
+ 900; // 2*WRITABLE_DELAY - bit |
static const int MIN_CHECK_RECEIVING_DELAY = 50; // ms |
@@ -195,14 +197,14 @@ P2PTransportChannel::P2PTransportChannel(const std::string& content_name, |
P2PTransportChannel::~P2PTransportChannel() { |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
- for (uint32 i = 0; i < allocator_sessions_.size(); ++i) |
+ for (uint32_t i = 0; i < allocator_sessions_.size(); ++i) |
delete allocator_sessions_[i]; |
} |
// Add the allocator session to our list so that we know which sessions |
// are still active. |
void P2PTransportChannel::AddAllocatorSession(PortAllocatorSession* session) { |
- session->set_generation(static_cast<uint32>(allocator_sessions_.size())); |
+ session->set_generation(static_cast<uint32_t>(allocator_sessions_.size())); |
allocator_sessions_.push_back(session); |
// We now only want to apply new candidates that we receive to the ports |
@@ -244,7 +246,7 @@ void P2PTransportChannel::SetIceRole(IceRole ice_role) { |
} |
} |
-void P2PTransportChannel::SetIceTiebreaker(uint64 tiebreaker) { |
+void P2PTransportChannel::SetIceTiebreaker(uint64_t tiebreaker) { |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
if (!ports_.empty()) { |
LOG(LS_ERROR) |
@@ -269,7 +271,7 @@ TransportChannelState P2PTransportChannel::GetState() const { |
return TransportChannelState::STATE_FAILED; |
} |
- for (uint32 i = 0; i < connections_.size(); ++i) { |
+ for (uint32_t i = 0; i < connections_.size(); ++i) { |
rtc::Network* network = connections_[i]->port()->Network(); |
if (networks.find(network) == networks.end()) { |
networks.insert(network); |
@@ -513,7 +515,7 @@ void P2PTransportChannel::OnUnknownAddress( |
// The foundation of the candidate is set to an arbitrary value, different |
// from the foundation for all other remote candidates. |
remote_candidate.set_foundation( |
- rtc::ToString<uint32>(rtc::ComputeCrc32(remote_candidate.id()))); |
+ rtc::ToString<uint32_t>(rtc::ComputeCrc32(remote_candidate.id()))); |
remote_candidate.set_priority(remote_candidate_priority); |
} |
@@ -609,7 +611,7 @@ void P2PTransportChannel::OnNominated(Connection* conn) { |
void P2PTransportChannel::OnCandidate(const Candidate& candidate) { |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
- uint32 generation = candidate.generation(); |
+ uint32_t generation = candidate.generation(); |
// Network may not guarantee the order of the candidate delivery. If a |
// remote candidate with an older generation arrives, drop it. |
if (generation != 0 && generation < remote_candidate_generation_) { |
@@ -736,7 +738,7 @@ bool P2PTransportChannel::FindConnection( |
return citer != connections_.end(); |
} |
-uint32 P2PTransportChannel::GetRemoteCandidateGeneration( |
+uint32_t P2PTransportChannel::GetRemoteCandidateGeneration( |
const Candidate& candidate) { |
// We need to keep track of the remote ice restart so newer |
// connections are prioritized over the older. |
@@ -748,7 +750,7 @@ uint32 P2PTransportChannel::GetRemoteCandidateGeneration( |
// Check if remote candidate is already cached. |
bool P2PTransportChannel::IsDuplicateRemoteCandidate( |
const Candidate& candidate) { |
- for (uint32 i = 0; i < remote_candidates_.size(); ++i) { |
+ for (uint32_t i = 0; i < remote_candidates_.size(); ++i) { |
if (remote_candidates_[i].IsEquivalent(candidate)) { |
return true; |
} |
@@ -761,7 +763,7 @@ void P2PTransportChannel::RememberRemoteCandidate( |
const Candidate& remote_candidate, PortInterface* origin_port) { |
// Remove any candidates whose generation is older than this one. The |
// presence of a new generation indicates that the old ones are not useful. |
- uint32 i = 0; |
+ uint32_t i = 0; |
while (i < remote_candidates_.size()) { |
if (remote_candidates_[i].generation() < remote_candidate.generation()) { |
LOG(INFO) << "Pruning candidate from old generation: " |
@@ -795,7 +797,7 @@ int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) { |
it->second = value; |
} |
- for (uint32 i = 0; i < ports_.size(); ++i) { |
+ for (uint32_t i = 0; i < ports_.size(); ++i) { |
int val = ports_[i]->SetOption(opt, value); |
if (val < 0) { |
// Because this also occurs deferred, probably no point in reporting an |
@@ -891,11 +893,11 @@ void P2PTransportChannel::Allocate() { |
// Monitor connection states. |
void P2PTransportChannel::UpdateConnectionStates() { |
- uint32 now = rtc::Time(); |
+ uint32_t now = rtc::Time(); |
// We need to copy the list of connections since some may delete themselves |
// when we call UpdateState. |
- for (uint32 i = 0; i < connections_.size(); ++i) |
+ for (uint32_t i = 0; i < connections_.size(); ++i) |
connections_[i]->UpdateState(now); |
} |
@@ -926,7 +928,7 @@ void P2PTransportChannel::SortConnections() { |
ConnectionCompare cmp; |
std::stable_sort(connections_.begin(), connections_.end(), cmp); |
LOG(LS_VERBOSE) << "Sorting available connections:"; |
- for (uint32 i = 0; i < connections_.size(); ++i) { |
+ for (uint32_t i = 0; i < connections_.size(); ++i) { |
LOG(LS_VERBOSE) << connections_[i]->ToString(); |
} |
@@ -953,7 +955,7 @@ void P2PTransportChannel::SortConnections() { |
// Check if all connections are timedout. |
bool all_connections_timedout = true; |
- for (uint32 i = 0; i < connections_.size(); ++i) { |
+ for (uint32_t i = 0; i < connections_.size(); ++i) { |
if (connections_[i]->write_state() != Connection::STATE_WRITE_TIMEOUT) { |
all_connections_timedout = false; |
break; |
@@ -1050,7 +1052,7 @@ void P2PTransportChannel::UpdateChannelState() { |
void P2PTransportChannel::HandleWritable() { |
ASSERT(worker_thread_ == rtc::Thread::Current()); |
if (!writable()) { |
- for (uint32 i = 0; i < allocator_sessions_.size(); ++i) { |
+ for (uint32_t i = 0; i < allocator_sessions_.size(); ++i) { |
if (allocator_sessions_[i]->IsGettingPorts()) { |
allocator_sessions_[i]->StopGettingPorts(); |
} |
@@ -1084,7 +1086,7 @@ Connection* P2PTransportChannel::GetBestConnectionOnNetwork( |
return best_connection_; |
// Otherwise, we return the top-most in sorted order. |
- for (uint32 i = 0; i < connections_.size(); ++i) { |
+ for (uint32_t i = 0; i < connections_.size(); ++i) { |
if (connections_[i]->port()->Network() == network) |
return connections_[i]; |
} |
@@ -1128,7 +1130,7 @@ void P2PTransportChannel::OnPing() { |
PingConnection(conn); |
// Post ourselves a message to perform the next ping. |
- uint32 delay = writable() ? WRITABLE_DELAY : UNWRITABLE_DELAY; |
+ uint32_t delay = writable() ? WRITABLE_DELAY : UNWRITABLE_DELAY; |
thread()->PostDelayed(delay, this, MSG_PING); |
} |
@@ -1173,7 +1175,7 @@ bool P2PTransportChannel::IsPingable(Connection* conn) { |
// reconnecting. The newly created connection should be selected as the ping |
// target to become writable instead. See the big comment in CompareConnections. |
Connection* P2PTransportChannel::FindNextPingableConnection() { |
- uint32 now = rtc::Time(); |
+ uint32_t now = rtc::Time(); |
if (best_connection_ && best_connection_->connected() && |
(best_connection_->write_state() == Connection::STATE_WRITABLE) && |
(best_connection_->last_ping_sent() + MAX_CURRENT_WRITABLE_DELAY <= |