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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 // Public for unit tests. | 156 // Public for unit tests. |
157 Connection* FindNextPingableConnection(); | 157 Connection* FindNextPingableConnection(); |
158 | 158 |
159 private: | 159 private: |
160 rtc::Thread* thread() { return worker_thread_; } | 160 rtc::Thread* thread() { return worker_thread_; } |
161 PortAllocatorSession* allocator_session() { | 161 PortAllocatorSession* allocator_session() { |
162 return allocator_sessions_.back(); | 162 return allocator_sessions_.back(); |
163 } | 163 } |
164 | 164 |
| 165 // A transport channel is weak if the current best connection is either |
| 166 // not receiving or not writable, or if there is no best connection at all. |
| 167 bool Weak() const; |
165 void UpdateConnectionStates(); | 168 void UpdateConnectionStates(); |
166 void RequestSort(); | 169 void RequestSort(); |
167 void SortConnections(); | 170 void SortConnections(); |
168 void SwitchBestConnectionTo(Connection* conn); | 171 void SwitchBestConnectionTo(Connection* conn); |
169 void UpdateChannelState(); | 172 void UpdateChannelState(); |
170 void HandleWritable(); | 173 void HandleWritable(); |
171 void HandleNotWritable(); | 174 void HandleNotWritable(); |
172 void HandleAllTimedOut(); | 175 void HandleAllTimedOut(); |
173 | 176 |
174 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; | 177 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; |
(...skipping 29 matching lines...) Expand all Loading... |
204 void OnConnectionStateChange(Connection* connection); | 207 void OnConnectionStateChange(Connection* connection); |
205 void OnReadPacket(Connection *connection, const char *data, size_t len, | 208 void OnReadPacket(Connection *connection, const char *data, size_t len, |
206 const rtc::PacketTime& packet_time); | 209 const rtc::PacketTime& packet_time); |
207 void OnReadyToSend(Connection* connection); | 210 void OnReadyToSend(Connection* connection); |
208 void OnConnectionDestroyed(Connection *connection); | 211 void OnConnectionDestroyed(Connection *connection); |
209 | 212 |
210 void OnNominated(Connection* conn); | 213 void OnNominated(Connection* conn); |
211 | 214 |
212 void OnMessage(rtc::Message* pmsg) override; | 215 void OnMessage(rtc::Message* pmsg) override; |
213 void OnSort(); | 216 void OnSort(); |
214 void OnPing(); | 217 void OnCheckAndPing(); |
215 | |
216 void OnCheckReceiving(); | |
217 | 218 |
218 void PruneConnections(); | 219 void PruneConnections(); |
219 Connection* best_nominated_connection() const; | 220 Connection* best_nominated_connection() const; |
220 | 221 |
221 P2PTransport* transport_; | 222 P2PTransport* transport_; |
222 PortAllocator* allocator_; | 223 PortAllocator* allocator_; |
223 rtc::Thread* worker_thread_; | 224 rtc::Thread* worker_thread_; |
224 bool incoming_only_; | 225 bool incoming_only_; |
225 int error_; | 226 int error_; |
226 std::vector<PortAllocatorSession*> allocator_sessions_; | 227 std::vector<PortAllocatorSession*> allocator_sessions_; |
(...skipping 14 matching lines...) Expand all Loading... |
241 std::string remote_ice_ufrag_; | 242 std::string remote_ice_ufrag_; |
242 std::string remote_ice_pwd_; | 243 std::string remote_ice_pwd_; |
243 IceMode remote_ice_mode_; | 244 IceMode remote_ice_mode_; |
244 IceRole ice_role_; | 245 IceRole ice_role_; |
245 uint64 tiebreaker_; | 246 uint64 tiebreaker_; |
246 uint32 remote_candidate_generation_; | 247 uint32 remote_candidate_generation_; |
247 IceGatheringState gathering_state_; | 248 IceGatheringState gathering_state_; |
248 | 249 |
249 int check_receiving_delay_; | 250 int check_receiving_delay_; |
250 int receiving_timeout_; | 251 int receiving_timeout_; |
| 252 uint32 last_ping_sent_ms_ = 0; |
251 | 253 |
252 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 254 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
253 }; | 255 }; |
254 | 256 |
255 } // namespace cricket | 257 } // namespace cricket |
256 | 258 |
257 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 259 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |