| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  *  Copyright 2004 The WebRTC Project Authors. All rights reserved. |     2  *  Copyright 2004 The WebRTC Project Authors. All rights reserved. | 
|     3  * |     3  * | 
|     4  *  Use of this source code is governed by a BSD-style license |     4  *  Use of this source code is governed by a BSD-style license | 
|     5  *  that can be found in the LICENSE file in the root of the source |     5  *  that can be found in the LICENSE file in the root of the source | 
|     6  *  tree. An additional intellectual property rights grant can be found |     6  *  tree. An additional intellectual property rights grant can be found | 
|     7  *  in the file PATENTS.  All contributing project authors may |     7  *  in the file PATENTS.  All contributing project authors may | 
|     8  *  be found in the AUTHORS file in the root of the source tree. |     8  *  be found in the AUTHORS file in the root of the source tree. | 
|     9  */ |     9  */ | 
|    10  |    10  | 
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1005 } |  1005 } | 
|  1006  |  1006  | 
|  1007 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { |  1007 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { | 
|  1008   ASSERT(network_thread_ == rtc::Thread::Current()); |  1008   ASSERT(network_thread_ == rtc::Thread::Current()); | 
|  1009   // Gather connection infos. |  1009   // Gather connection infos. | 
|  1010   infos->clear(); |  1010   infos->clear(); | 
|  1011  |  1011  | 
|  1012   for (Connection* connection : connections_) { |  1012   for (Connection* connection : connections_) { | 
|  1013     ConnectionInfo info = connection->stats(); |  1013     ConnectionInfo info = connection->stats(); | 
|  1014     info.best_connection = (selected_connection_ == connection); |  1014     info.best_connection = (selected_connection_ == connection); | 
|  1015     info.receiving = connection->receiving(); |  1015     infos->push_back(std::move(info)); | 
|  1016     info.writable = (connection->write_state() == Connection::STATE_WRITABLE); |  | 
|  1017     info.timeout = |  | 
|  1018         (connection->write_state() == Connection::STATE_WRITE_TIMEOUT); |  | 
|  1019     info.new_connection = !connection->reported(); |  | 
|  1020     connection->set_reported(true); |  1016     connection->set_reported(true); | 
|  1021     info.rtt = connection->rtt(); |  | 
|  1022     info.local_candidate = connection->local_candidate(); |  | 
|  1023     info.remote_candidate = connection->remote_candidate(); |  | 
|  1024     info.key = connection; |  | 
|  1025     infos->push_back(info); |  | 
|  1026   } |  1017   } | 
|  1027  |  1018  | 
|  1028   return true; |  1019   return true; | 
|  1029 } |  1020 } | 
|  1030  |  1021  | 
|  1031 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { |  1022 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { | 
|  1032   OptionMap::const_iterator it = options_.find(rtc::Socket::OPT_DSCP); |  1023   OptionMap::const_iterator it = options_.find(rtc::Socket::OPT_DSCP); | 
|  1033   if (it == options_.end()) { |  1024   if (it == options_.end()) { | 
|  1034     return rtc::DSCP_NO_CHANGE; |  1025     return rtc::DSCP_NO_CHANGE; | 
|  1035   } |  1026   } | 
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1552                                      int64_t now) const { |  1543                                      int64_t now) const { | 
|  1553   const Candidate& remote = conn->remote_candidate(); |  1544   const Candidate& remote = conn->remote_candidate(); | 
|  1554   // We should never get this far with an empty remote ufrag. |  1545   // We should never get this far with an empty remote ufrag. | 
|  1555   ASSERT(!remote.username().empty()); |  1546   ASSERT(!remote.username().empty()); | 
|  1556   if (remote.username().empty() || remote.password().empty()) { |  1547   if (remote.username().empty() || remote.password().empty()) { | 
|  1557     // If we don't have an ICE ufrag and pwd, there's no way we can ping. |  1548     // If we don't have an ICE ufrag and pwd, there's no way we can ping. | 
|  1558     return false; |  1549     return false; | 
|  1559   } |  1550   } | 
|  1560  |  1551  | 
|  1561   // A failed connection will not be pinged. |  1552   // A failed connection will not be pinged. | 
|  1562   if (conn->state() == Connection::STATE_FAILED) { |  1553   if (conn->state() == IceCandidatePairState::FAILED) { | 
|  1563     return false; |  1554     return false; | 
|  1564   } |  1555   } | 
|  1565  |  1556  | 
|  1566   // An never connected connection cannot be written to at all, so pinging is |  1557   // An never connected connection cannot be written to at all, so pinging is | 
|  1567   // out of the question. However, if it has become WRITABLE, it is in the |  1558   // out of the question. However, if it has become WRITABLE, it is in the | 
|  1568   // reconnecting state so ping is needed. |  1559   // reconnecting state so ping is needed. | 
|  1569   if (!conn->connected() && !conn->writable()) { |  1560   if (!conn->connected() && !conn->writable()) { | 
|  1570     return false; |  1561     return false; | 
|  1571   } |  1562   } | 
|  1572  |  1563  | 
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2016  |  2007  | 
|  2017   // During the initial state when nothing has been pinged yet, return the first |  2008   // During the initial state when nothing has been pinged yet, return the first | 
|  2018   // one in the ordered |connections_|. |  2009   // one in the ordered |connections_|. | 
|  2019   return *(std::find_if(connections_.begin(), connections_.end(), |  2010   return *(std::find_if(connections_.begin(), connections_.end(), | 
|  2020                         [conn1, conn2](Connection* conn) { |  2011                         [conn1, conn2](Connection* conn) { | 
|  2021                           return conn == conn1 || conn == conn2; |  2012                           return conn == conn1 || conn == conn2; | 
|  2022                         })); |  2013                         })); | 
|  2023 } |  2014 } | 
|  2024  |  2015  | 
|  2025 }  // namespace cricket |  2016 }  // namespace cricket | 
| OLD | NEW |