| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Writable connections are pinged at a slower rate once stabilized. | 78 // Writable connections are pinged at a slower rate once stabilized. |
| 79 const int STABLE_WRITABLE_CONNECTION_PING_INTERVAL = 2500; // ms | 79 const int STABLE_WRITABLE_CONNECTION_PING_INTERVAL = 2500; // ms |
| 80 | 80 |
| 81 static const int MIN_CHECK_RECEIVING_INTERVAL = 50; // ms | 81 static const int MIN_CHECK_RECEIVING_INTERVAL = 50; // ms |
| 82 | 82 |
| 83 static const int RECEIVING_SWITCHING_DELAY = 1000; // ms | 83 static const int RECEIVING_SWITCHING_DELAY = 1000; // ms |
| 84 | 84 |
| 85 // We periodically check if any existing networks do not have any connection | 85 // We periodically check if any existing networks do not have any connection |
| 86 // and regather on those networks. | 86 // and regather on those networks. |
| 87 static const int DEFAULT_REGATHER_ON_FAILED_NETWORKS_INTERVAL = 5 * 60 * 1000; | 87 static const int DEFAULT_REGATHER_ON_FAILED_NETWORKS_INTERVAL = 5 * 60 * 1000; |
| 88 |
| 89 static constexpr int DEFAULT_BACKUP_CONNECTION_PING_INTERVAL = 25 * 1000; |
| 90 |
| 88 static constexpr int a_is_better = 1; | 91 static constexpr int a_is_better = 1; |
| 89 static constexpr int b_is_better = -1; | 92 static constexpr int b_is_better = -1; |
| 90 | 93 |
| 91 P2PTransportChannel::P2PTransportChannel(const std::string& transport_name, | 94 P2PTransportChannel::P2PTransportChannel(const std::string& transport_name, |
| 92 int component, | 95 int component, |
| 93 P2PTransport* transport, | 96 P2PTransport* transport, |
| 94 PortAllocator* allocator) | 97 PortAllocator* allocator) |
| 95 : P2PTransportChannel(transport_name, component, allocator) {} | 98 : P2PTransportChannel(transport_name, component, allocator) {} |
| 96 | 99 |
| 97 P2PTransportChannel::P2PTransportChannel(const std::string& transport_name, | 100 P2PTransportChannel::P2PTransportChannel(const std::string& transport_name, |
| 98 int component, | 101 int component, |
| 99 PortAllocator* allocator) | 102 PortAllocator* allocator) |
| 100 : TransportChannelImpl(transport_name, component), | 103 : TransportChannelImpl(transport_name, component), |
| 101 allocator_(allocator), | 104 allocator_(allocator), |
| 102 worker_thread_(rtc::Thread::Current()), | 105 worker_thread_(rtc::Thread::Current()), |
| 103 incoming_only_(false), | 106 incoming_only_(false), |
| 104 error_(0), | 107 error_(0), |
| 105 sort_dirty_(false), | 108 sort_dirty_(false), |
| 106 remote_ice_mode_(ICEMODE_FULL), | 109 remote_ice_mode_(ICEMODE_FULL), |
| 107 ice_role_(ICEROLE_UNKNOWN), | 110 ice_role_(ICEROLE_UNKNOWN), |
| 108 tiebreaker_(0), | 111 tiebreaker_(0), |
| 109 gathering_state_(kIceGatheringNew), | 112 gathering_state_(kIceGatheringNew), |
| 110 check_receiving_interval_(MIN_CHECK_RECEIVING_INTERVAL * 5), | 113 check_receiving_interval_(MIN_CHECK_RECEIVING_INTERVAL * 5), |
| 111 config_(MIN_CHECK_RECEIVING_INTERVAL * 50 /* receiving_timeout */, | 114 config_(MIN_CHECK_RECEIVING_INTERVAL * 50 /* receiving_timeout */, |
| 112 0 /* backup_connection_ping_interval */, | 115 DEFAULT_BACKUP_CONNECTION_PING_INTERVAL, |
| 113 GATHER_ONCE /* continual_gathering_policy */, | 116 GATHER_ONCE /* continual_gathering_policy */, |
| 114 false /* prioritize_most_likely_candidate_pairs */, | 117 false /* prioritize_most_likely_candidate_pairs */, |
| 115 STABLE_WRITABLE_CONNECTION_PING_INTERVAL, | 118 STABLE_WRITABLE_CONNECTION_PING_INTERVAL, |
| 116 true /* presume_writable_when_fully_relayed */, | 119 true /* presume_writable_when_fully_relayed */, |
| 117 DEFAULT_REGATHER_ON_FAILED_NETWORKS_INTERVAL, | 120 DEFAULT_REGATHER_ON_FAILED_NETWORKS_INTERVAL, |
| 118 RECEIVING_SWITCHING_DELAY) { | 121 RECEIVING_SWITCHING_DELAY) { |
| 119 uint32_t weak_ping_interval = ::strtoul( | 122 uint32_t weak_ping_interval = ::strtoul( |
| 120 webrtc::field_trial::FindFullName("WebRTC-StunInterPacketDelay").c_str(), | 123 webrtc::field_trial::FindFullName("WebRTC-StunInterPacketDelay").c_str(), |
| 121 nullptr, 10); | 124 nullptr, 10); |
| 122 if (weak_ping_interval) { | 125 if (weak_ping_interval) { |
| (...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 | 1932 |
| 1930 // During the initial state when nothing has been pinged yet, return the first | 1933 // During the initial state when nothing has been pinged yet, return the first |
| 1931 // one in the ordered |connections_|. | 1934 // one in the ordered |connections_|. |
| 1932 return *(std::find_if(connections_.begin(), connections_.end(), | 1935 return *(std::find_if(connections_.begin(), connections_.end(), |
| 1933 [conn1, conn2](Connection* conn) { | 1936 [conn1, conn2](Connection* conn) { |
| 1934 return conn == conn1 || conn == conn2; | 1937 return conn == conn1 || conn == conn2; |
| 1935 })); | 1938 })); |
| 1936 } | 1939 } |
| 1937 | 1940 |
| 1938 } // namespace cricket | 1941 } // namespace cricket |
| OLD | NEW |