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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 error_ = best_connection_->GetError(); | 1010 error_ = best_connection_->GetError(); |
1011 } | 1011 } |
1012 return sent; | 1012 return sent; |
1013 } | 1013 } |
1014 | 1014 |
1015 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { | 1015 bool P2PTransportChannel::GetStats(ConnectionInfos *infos) { |
1016 ASSERT(worker_thread_ == rtc::Thread::Current()); | 1016 ASSERT(worker_thread_ == rtc::Thread::Current()); |
1017 // Gather connection infos. | 1017 // Gather connection infos. |
1018 infos->clear(); | 1018 infos->clear(); |
1019 | 1019 |
1020 std::vector<Connection *>::const_iterator it; | |
1021 for (Connection* connection : connections_) { | 1020 for (Connection* connection : connections_) { |
1022 ConnectionInfo info; | 1021 ConnectionInfo info = connection->stats(); |
1023 info.best_connection = (best_connection_ == connection); | 1022 info.best_connection = (best_connection_ == connection); |
1024 info.receiving = connection->receiving(); | 1023 info.receiving = connection->receiving(); |
1025 info.writable = | 1024 info.writable = (connection->write_state() == Connection::STATE_WRITABLE); |
1026 (connection->write_state() == Connection::STATE_WRITABLE); | |
1027 info.timeout = | 1025 info.timeout = |
1028 (connection->write_state() == Connection::STATE_WRITE_TIMEOUT); | 1026 (connection->write_state() == Connection::STATE_WRITE_TIMEOUT); |
1029 info.new_connection = !connection->reported(); | 1027 info.new_connection = !connection->reported(); |
1030 connection->set_reported(true); | 1028 connection->set_reported(true); |
1031 info.rtt = connection->rtt(); | 1029 info.rtt = connection->rtt(); |
1032 info.sent_total_bytes = connection->sent_total_bytes(); | |
1033 info.sent_bytes_second = connection->sent_bytes_second(); | |
1034 info.sent_discarded_packets = connection->sent_discarded_packets(); | |
1035 info.sent_total_packets = connection->sent_total_packets(); | |
1036 info.recv_total_bytes = connection->recv_total_bytes(); | |
1037 info.recv_bytes_second = connection->recv_bytes_second(); | |
1038 info.local_candidate = connection->local_candidate(); | 1030 info.local_candidate = connection->local_candidate(); |
1039 info.remote_candidate = connection->remote_candidate(); | 1031 info.remote_candidate = connection->remote_candidate(); |
1040 info.key = connection; | 1032 info.key = connection; |
1041 infos->push_back(info); | 1033 infos->push_back(info); |
1042 } | 1034 } |
1043 | 1035 |
1044 return true; | 1036 return true; |
1045 } | 1037 } |
1046 | 1038 |
1047 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { | 1039 rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 | 1687 |
1696 // During the initial state when nothing has been pinged yet, return the first | 1688 // During the initial state when nothing has been pinged yet, return the first |
1697 // one in the ordered |connections_|. | 1689 // one in the ordered |connections_|. |
1698 return *(std::find_if(connections_.begin(), connections_.end(), | 1690 return *(std::find_if(connections_.begin(), connections_.end(), |
1699 [conn1, conn2](Connection* conn) { | 1691 [conn1, conn2](Connection* conn) { |
1700 return conn == conn1 || conn == conn2; | 1692 return conn == conn1 || conn == conn2; |
1701 })); | 1693 })); |
1702 } | 1694 } |
1703 | 1695 |
1704 } // namespace cricket | 1696 } // namespace cricket |
OLD | NEW |