Chromium Code Reviews| 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 } | 1003 } |
| 1004 return sent; | 1004 return sent; |
| 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 infos->push_back(connection->stats(selected_connection_ == connection)); |
|
Taylor Brandstetter
2016/12/23 18:59:45
I'd prefer if "best_connection" was set here, rath
hbos
2016/12/27 10:24:34
Done.
| |
| 1014 info.best_connection = (selected_connection_ == connection); | |
| 1015 info.receiving = connection->receiving(); | |
| 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); | 1014 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 } | 1015 } |
| 1027 | 1016 |
| 1028 return true; | 1017 return true; |
| 1029 } | 1018 } |
| 1030 | 1019 |
| 1031 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { | 1020 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { |
| 1032 OptionMap::const_iterator it = options_.find(rtc::Socket::OPT_DSCP); | 1021 OptionMap::const_iterator it = options_.find(rtc::Socket::OPT_DSCP); |
| 1033 if (it == options_.end()) { | 1022 if (it == options_.end()) { |
| 1034 return rtc::DSCP_NO_CHANGE; | 1023 return rtc::DSCP_NO_CHANGE; |
| 1035 } | 1024 } |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1552 int64_t now) const { | 1541 int64_t now) const { |
| 1553 const Candidate& remote = conn->remote_candidate(); | 1542 const Candidate& remote = conn->remote_candidate(); |
| 1554 // We should never get this far with an empty remote ufrag. | 1543 // We should never get this far with an empty remote ufrag. |
| 1555 ASSERT(!remote.username().empty()); | 1544 ASSERT(!remote.username().empty()); |
| 1556 if (remote.username().empty() || remote.password().empty()) { | 1545 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. | 1546 // If we don't have an ICE ufrag and pwd, there's no way we can ping. |
| 1558 return false; | 1547 return false; |
| 1559 } | 1548 } |
| 1560 | 1549 |
| 1561 // A failed connection will not be pinged. | 1550 // A failed connection will not be pinged. |
| 1562 if (conn->state() == Connection::STATE_FAILED) { | 1551 if (conn->state() == IceCandidatePairState::FAILED) { |
| 1563 return false; | 1552 return false; |
| 1564 } | 1553 } |
| 1565 | 1554 |
| 1566 // An never connected connection cannot be written to at all, so pinging is | 1555 // 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 | 1556 // out of the question. However, if it has become WRITABLE, it is in the |
| 1568 // reconnecting state so ping is needed. | 1557 // reconnecting state so ping is needed. |
| 1569 if (!conn->connected() && !conn->writable()) { | 1558 if (!conn->connected() && !conn->writable()) { |
| 1570 return false; | 1559 return false; |
| 1571 } | 1560 } |
| 1572 | 1561 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2016 | 2005 |
| 2017 // During the initial state when nothing has been pinged yet, return the first | 2006 // During the initial state when nothing has been pinged yet, return the first |
| 2018 // one in the ordered |connections_|. | 2007 // one in the ordered |connections_|. |
| 2019 return *(std::find_if(connections_.begin(), connections_.end(), | 2008 return *(std::find_if(connections_.begin(), connections_.end(), |
| 2020 [conn1, conn2](Connection* conn) { | 2009 [conn1, conn2](Connection* conn) { |
| 2021 return conn == conn1 || conn == conn2; | 2010 return conn == conn1 || conn == conn2; |
| 2022 })); | 2011 })); |
| 2023 } | 2012 } |
| 2024 | 2013 |
| 2025 } // namespace cricket | 2014 } // namespace cricket |
| OLD | NEW |