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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 } | 151 } |
152 | 152 |
153 int receiving_timeout() const { return receiving_timeout_; } | 153 int receiving_timeout() const { return receiving_timeout_; } |
154 int check_receiving_delay() const { return check_receiving_delay_; } | 154 int check_receiving_delay() const { return check_receiving_delay_; } |
155 | 155 |
156 // Helper method used only in unittest. | 156 // Helper method used only in unittest. |
157 rtc::DiffServCodePoint DefaultDscpValue() const; | 157 rtc::DiffServCodePoint DefaultDscpValue() const; |
158 | 158 |
159 // Public for unit tests. | 159 // Public for unit tests. |
160 Connection* FindNextPingableConnection(); | 160 Connection* FindNextPingableConnection(); |
161 // Public for unit tests. | |
162 // |connections_| should not be changed from outside. | |
pthatcher1
2015/09/21 23:49:18
from outside => from the outside.
But if it's mar
honghaiz3
2015/09/22 19:35:08
Right, don't need the comments.
| |
163 const std::vector<Connection*>& connections() { return connections_; } | |
161 | 164 |
162 private: | 165 private: |
163 rtc::Thread* thread() { return worker_thread_; } | 166 rtc::Thread* thread() { return worker_thread_; } |
164 PortAllocatorSession* allocator_session() { | 167 PortAllocatorSession* allocator_session() { |
165 return allocator_sessions_.back(); | 168 return allocator_sessions_.back(); |
166 } | 169 } |
167 | 170 |
171 // A transport channel is weak if the current best connection is either | |
172 // not receiving or not writable, or if there is no best connection at all. | |
173 bool Weak() const; | |
168 void Allocate(); | 174 void Allocate(); |
169 void UpdateConnectionStates(); | 175 void UpdateConnectionStates(); |
170 void RequestSort(); | 176 void RequestSort(); |
171 void SortConnections(); | 177 void SortConnections(); |
172 void SwitchBestConnectionTo(Connection* conn); | 178 void SwitchBestConnectionTo(Connection* conn); |
173 void UpdateChannelState(); | 179 void UpdateChannelState(); |
174 void HandleWritable(); | 180 void HandleWritable(); |
175 void HandleNotWritable(); | 181 void HandleNotWritable(); |
176 void HandleAllTimedOut(); | 182 void HandleAllTimedOut(); |
177 | 183 |
(...skipping 30 matching lines...) Expand all Loading... | |
208 void OnConnectionStateChange(Connection* connection); | 214 void OnConnectionStateChange(Connection* connection); |
209 void OnReadPacket(Connection *connection, const char *data, size_t len, | 215 void OnReadPacket(Connection *connection, const char *data, size_t len, |
210 const rtc::PacketTime& packet_time); | 216 const rtc::PacketTime& packet_time); |
211 void OnReadyToSend(Connection* connection); | 217 void OnReadyToSend(Connection* connection); |
212 void OnConnectionDestroyed(Connection *connection); | 218 void OnConnectionDestroyed(Connection *connection); |
213 | 219 |
214 void OnNominated(Connection* conn); | 220 void OnNominated(Connection* conn); |
215 | 221 |
216 void OnMessage(rtc::Message *pmsg) override; | 222 void OnMessage(rtc::Message *pmsg) override; |
217 void OnSort(); | 223 void OnSort(); |
218 void OnPing(); | 224 void OnCheckAndPing(); |
219 | |
220 void OnCheckReceiving(); | |
221 | 225 |
222 void PruneConnections(); | 226 void PruneConnections(); |
223 Connection* best_nominated_connection() const; | 227 Connection* best_nominated_connection() const; |
224 | 228 |
225 P2PTransport* transport_; | 229 P2PTransport* transport_; |
226 PortAllocator *allocator_; | 230 PortAllocator *allocator_; |
227 rtc::Thread *worker_thread_; | 231 rtc::Thread *worker_thread_; |
228 bool incoming_only_; | 232 bool incoming_only_; |
229 bool waiting_for_signaling_; | 233 bool waiting_for_signaling_; |
230 int error_; | 234 int error_; |
(...skipping 13 matching lines...) Expand all Loading... | |
244 std::string ice_pwd_; | 248 std::string ice_pwd_; |
245 std::string remote_ice_ufrag_; | 249 std::string remote_ice_ufrag_; |
246 std::string remote_ice_pwd_; | 250 std::string remote_ice_pwd_; |
247 IceMode remote_ice_mode_; | 251 IceMode remote_ice_mode_; |
248 IceRole ice_role_; | 252 IceRole ice_role_; |
249 uint64 tiebreaker_; | 253 uint64 tiebreaker_; |
250 uint32 remote_candidate_generation_; | 254 uint32 remote_candidate_generation_; |
251 | 255 |
252 int check_receiving_delay_; | 256 int check_receiving_delay_; |
253 int receiving_timeout_; | 257 int receiving_timeout_; |
258 uint32 last_ping_sent_; | |
pthatcher1
2015/09/21 23:49:18
Can you make it clear this is a timestamp, perhaps
honghaiz3
2015/09/22 19:35:08
Done.
| |
254 | 259 |
255 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 260 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
256 }; | 261 }; |
257 | 262 |
258 } // namespace cricket | 263 } // namespace cricket |
259 | 264 |
260 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 265 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |