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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 pinged_connections_.clear(); | 1684 pinged_connections_.clear(); |
1685 } | 1685 } |
1686 | 1686 |
1687 // Among un-pinged pingable connections, "more pingable" takes precedence. | 1687 // Among un-pinged pingable connections, "more pingable" takes precedence. |
1688 std::vector<Connection*> pingable_connections; | 1688 std::vector<Connection*> pingable_connections; |
1689 std::copy_if(unpinged_connections_.begin(), unpinged_connections_.end(), | 1689 std::copy_if(unpinged_connections_.begin(), unpinged_connections_.end(), |
1690 std::back_inserter(pingable_connections), | 1690 std::back_inserter(pingable_connections), |
1691 [this, now](Connection* conn) { return IsPingable(conn, now); }); | 1691 [this, now](Connection* conn) { return IsPingable(conn, now); }); |
1692 auto iter = | 1692 auto iter = |
1693 std::max_element(pingable_connections.begin(), pingable_connections.end(), | 1693 std::max_element(pingable_connections.begin(), pingable_connections.end(), |
1694 [this, now](Connection* conn1, Connection* conn2) { | 1694 [this](Connection* conn1, Connection* conn2) { |
1695 return MorePingable(conn1, conn2) == conn2; | 1695 return MorePingable(conn1, conn2) == conn2; |
1696 }); | 1696 }); |
1697 if (iter != pingable_connections.end()) { | 1697 if (iter != pingable_connections.end()) { |
1698 return *iter; | 1698 return *iter; |
1699 } | 1699 } |
1700 return nullptr; | 1700 return nullptr; |
1701 } | 1701 } |
1702 | 1702 |
1703 void P2PTransportChannel::MarkConnectionPinged(Connection* conn) { | 1703 void P2PTransportChannel::MarkConnectionPinged(Connection* conn) { |
1704 if (conn && pinged_connections_.insert(conn).second) { | 1704 if (conn && pinged_connections_.insert(conn).second) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 | 2035 |
2036 void P2PTransportChannel::set_receiving(bool receiving) { | 2036 void P2PTransportChannel::set_receiving(bool receiving) { |
2037 if (receiving_ == receiving) { | 2037 if (receiving_ == receiving) { |
2038 return; | 2038 return; |
2039 } | 2039 } |
2040 receiving_ = receiving; | 2040 receiving_ = receiving; |
2041 SignalReceivingState(this); | 2041 SignalReceivingState(this); |
2042 } | 2042 } |
2043 | 2043 |
2044 } // namespace cricket | 2044 } // namespace cricket |
OLD | NEW |