| Index: webrtc/p2p/base/p2ptransportchannel.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
|
| index 3fef947109eb93e17481479242289b0407c80c1a..6e5be892f22323e2f309ff4ea498e500f5bd7ba9 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel.cc
|
| @@ -129,14 +129,14 @@ P2PTransportChannel::P2PTransportChannel(const std::string& transport_name,
|
| }
|
|
|
| P2PTransportChannel::~P2PTransportChannel() {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| }
|
|
|
| // Add the allocator session to our list so that we know which sessions
|
| // are still active.
|
| void P2PTransportChannel::AddAllocatorSession(
|
| std::unique_ptr<PortAllocatorSession> session) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| session->set_generation(static_cast<uint32_t>(allocator_sessions_.size()));
|
| session->SignalPortReady.connect(this, &P2PTransportChannel::OnPortReady);
|
| @@ -247,7 +247,7 @@ bool P2PTransportChannel::MaybeSwitchSelectedConnection(
|
| }
|
|
|
| void P2PTransportChannel::SetIceRole(IceRole ice_role) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| if (ice_role_ != ice_role) {
|
| ice_role_ = ice_role;
|
| for (PortInterface* port : ports_) {
|
| @@ -262,7 +262,7 @@ void P2PTransportChannel::SetIceRole(IceRole ice_role) {
|
| }
|
|
|
| void P2PTransportChannel::SetIceTiebreaker(uint64_t tiebreaker) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| if (!ports_.empty() || !pruned_ports_.empty()) {
|
| LOG(LS_ERROR)
|
| << "Attempt to change tiebreaker after Port has been allocated.";
|
| @@ -310,7 +310,7 @@ TransportChannelState P2PTransportChannel::ComputeState() const {
|
| }
|
|
|
| void P2PTransportChannel::SetIceParameters(const IceParameters& ice_params) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| LOG(LS_INFO) << "Set ICE ufrag: " << ice_params.ufrag
|
| << " pwd: " << ice_params.pwd << " on transport "
|
| << transport_name();
|
| @@ -321,7 +321,7 @@ void P2PTransportChannel::SetIceParameters(const IceParameters& ice_params) {
|
|
|
| void P2PTransportChannel::SetRemoteIceParameters(
|
| const IceParameters& ice_params) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| LOG(LS_INFO) << "Remote supports ICE renomination ? "
|
| << ice_params.renomination;
|
| IceParameters* current_ice = remote_ice();
|
| @@ -502,7 +502,7 @@ void P2PTransportChannel::MaybeStartGathering() {
|
| // A new port is available, attempt to make connections for it
|
| void P2PTransportChannel::OnPortReady(PortAllocatorSession *session,
|
| PortInterface* port) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // Set in-effect options on the new port
|
| for (OptionMap::const_iterator it = options_.begin();
|
| @@ -547,7 +547,7 @@ void P2PTransportChannel::OnPortReady(PortAllocatorSession *session,
|
| void P2PTransportChannel::OnCandidatesReady(
|
| PortAllocatorSession* session,
|
| const std::vector<Candidate>& candidates) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| for (size_t i = 0; i < candidates.size(); ++i) {
|
| SignalCandidateGathered(this, candidates[i]);
|
| }
|
| @@ -555,7 +555,7 @@ void P2PTransportChannel::OnCandidatesReady(
|
|
|
| void P2PTransportChannel::OnCandidatesAllocationDone(
|
| PortAllocatorSession* session) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| if (config_.gather_continually()) {
|
| LOG(LS_INFO) << "P2PTransportChannel: " << transport_name()
|
| << ", component " << component()
|
| @@ -575,7 +575,7 @@ void P2PTransportChannel::OnUnknownAddress(
|
| const rtc::SocketAddress& address, ProtocolType proto,
|
| IceMessage* stun_msg, const std::string &remote_username,
|
| bool port_muxed) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // Port has received a valid stun packet from an address that no Connection
|
| // is currently available for. See if we already have a candidate with the
|
| @@ -714,8 +714,8 @@ const IceParameters* P2PTransportChannel::FindRemoteIceFromUfrag(
|
| }
|
|
|
| void P2PTransportChannel::OnNominated(Connection* conn) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| - ASSERT(ice_role_ == ICEROLE_CONTROLLED);
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(ice_role_ == ICEROLE_CONTROLLED);
|
|
|
| if (selected_connection_ == conn) {
|
| return;
|
| @@ -734,7 +734,7 @@ void P2PTransportChannel::OnNominated(Connection* conn) {
|
| }
|
|
|
| void P2PTransportChannel::AddRemoteCandidate(const Candidate& candidate) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| uint32_t generation = GetRemoteCandidateGeneration(candidate);
|
| // If a remote candidate with a previous generation arrives, drop it.
|
| @@ -798,7 +798,7 @@ void P2PTransportChannel::RemoveRemoteCandidate(
|
| // the origin port.
|
| bool P2PTransportChannel::CreateConnections(const Candidate& remote_candidate,
|
| PortInterface* origin_port) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // If we've already seen the new remote candidate (in the current candidate
|
| // generation), then we shouldn't try creating connections for it.
|
| @@ -947,7 +947,7 @@ void P2PTransportChannel::RememberRemoteCandidate(
|
| // Set options on ourselves is simply setting options on all of our available
|
| // port objects.
|
| int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| OptionMap::iterator it = options_.find(opt);
|
| if (it == options_.end()) {
|
| options_.insert(std::make_pair(opt, value));
|
| @@ -970,7 +970,7 @@ int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
|
| }
|
|
|
| bool P2PTransportChannel::GetOption(rtc::Socket::Option opt, int* value) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| const auto& found = options_.find(opt);
|
| if (found == options_.end()) {
|
| @@ -984,7 +984,7 @@ bool P2PTransportChannel::GetOption(rtc::Socket::Option opt, int* value) {
|
| int P2PTransportChannel::SendPacket(const char *data, size_t len,
|
| const rtc::PacketOptions& options,
|
| int flags) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| if (flags != 0) {
|
| error_ = EINVAL;
|
| return -1;
|
| @@ -999,14 +999,14 @@ int P2PTransportChannel::SendPacket(const char *data, size_t len,
|
| last_sent_packet_id_ = options.packet_id;
|
| int sent = selected_connection_->Send(data, len, options);
|
| if (sent <= 0) {
|
| - ASSERT(sent < 0);
|
| + RTC_DCHECK(sent < 0);
|
| error_ = selected_connection_->GetError();
|
| }
|
| return sent;
|
| }
|
|
|
| bool P2PTransportChannel::GetStats(ConnectionInfos *infos) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| // Gather connection infos.
|
| infos->clear();
|
|
|
| @@ -1221,7 +1221,7 @@ bool P2PTransportChannel::PresumedWritable(const Connection* conn) const {
|
| // Sort the available connections to find the best one. We also monitor
|
| // the number of available connections and the current state.
|
| void P2PTransportChannel::SortConnectionsAndUpdateState() {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // Make sure the connection states are up-to-date since this affects how they
|
| // will be sorted.
|
| @@ -1544,7 +1544,7 @@ bool P2PTransportChannel::IsPingable(const Connection* conn,
|
| int64_t now) const {
|
| const Candidate& remote = conn->remote_candidate();
|
| // We should never get this far with an empty remote ufrag.
|
| - ASSERT(!remote.username().empty());
|
| + RTC_DCHECK(!remote.username().empty());
|
| if (remote.username().empty() || remote.password().empty()) {
|
| // If we don't have an ICE ufrag and pwd, there's no way we can ping.
|
| return false;
|
| @@ -1768,7 +1768,7 @@ bool P2PTransportChannel::GetUseCandidateAttr(Connection* conn,
|
| // the selected connection again. It could have become usable, or become
|
| // unusable.
|
| void P2PTransportChannel::OnConnectionStateChange(Connection* connection) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // May stop the allocator session when at least one connection becomes
|
| // strongly connected after starting to get ports and the local candidate of
|
| @@ -1790,7 +1790,7 @@ void P2PTransportChannel::OnConnectionStateChange(Connection* connection) {
|
| // When a connection is removed, edit it out, and then update our best
|
| // connection.
|
| void P2PTransportChannel::OnConnectionDestroyed(Connection* connection) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // Note: the previous selected_connection_ may be destroyed by now, so don't
|
| // use it.
|
| @@ -1798,7 +1798,7 @@ void P2PTransportChannel::OnConnectionDestroyed(Connection* connection) {
|
| // Remove this connection from the list.
|
| std::vector<Connection*>::iterator iter =
|
| std::find(connections_.begin(), connections_.end(), connection);
|
| - ASSERT(iter != connections_.end());
|
| + RTC_DCHECK(iter != connections_.end());
|
| pinged_connections_.erase(*iter);
|
| unpinged_connections_.erase(*iter);
|
| connections_.erase(iter);
|
| @@ -1828,7 +1828,7 @@ void P2PTransportChannel::OnConnectionDestroyed(Connection* connection) {
|
| // When a port is destroyed, remove it from our list of ports to use for
|
| // connection attempts.
|
| void P2PTransportChannel::OnPortDestroyed(PortInterface* port) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| ports_.erase(std::remove(ports_.begin(), ports_.end(), port), ports_.end());
|
| pruned_ports_.erase(
|
| @@ -1841,7 +1841,7 @@ void P2PTransportChannel::OnPortDestroyed(PortInterface* port) {
|
| void P2PTransportChannel::OnPortsPruned(
|
| PortAllocatorSession* session,
|
| const std::vector<PortInterface*>& ports) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| for (PortInterface* port : ports) {
|
| if (PrunePort(port)) {
|
| LOG(INFO) << "Removed port: " << port->ToString() << " " << ports_.size()
|
| @@ -1853,7 +1853,7 @@ void P2PTransportChannel::OnPortsPruned(
|
| void P2PTransportChannel::OnCandidatesRemoved(
|
| PortAllocatorSession* session,
|
| const std::vector<Candidate>& candidates) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
| // Do not signal candidate removals if continual gathering is not enabled, or
|
| // if this is not the last session because an ICE restart would have signaled
|
| // the remote side to remove all candidates in previous sessions.
|
| @@ -1903,7 +1903,7 @@ void P2PTransportChannel::OnReadPacket(Connection* connection,
|
| const char* data,
|
| size_t len,
|
| const rtc::PacketTime& packet_time) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| // Do not deliver, if packet doesn't belong to the correct transport channel.
|
| if (!FindConnection(connection))
|
| @@ -1920,7 +1920,7 @@ void P2PTransportChannel::OnReadPacket(Connection* connection,
|
| }
|
|
|
| void P2PTransportChannel::OnSentPacket(const rtc::SentPacket& sent_packet) {
|
| - ASSERT(network_thread_ == rtc::Thread::Current());
|
| + RTC_DCHECK(network_thread_ == rtc::Thread::Current());
|
|
|
| SignalSentPacket(this, sent_packet);
|
| }
|
|
|