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