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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Public for unit tests. | 202 // Public for unit tests. |
203 PortAllocatorSession* allocator_session() { | 203 PortAllocatorSession* allocator_session() { |
204 return allocator_sessions_.back().get(); | 204 return allocator_sessions_.back().get(); |
205 } | 205 } |
206 | 206 |
207 // Public for unit tests. | 207 // Public for unit tests. |
208 const std::vector<RemoteCandidate>& remote_candidates() const { | 208 const std::vector<RemoteCandidate>& remote_candidates() const { |
209 return remote_candidates_; | 209 return remote_candidates_; |
210 } | 210 } |
211 | 211 |
| 212 // Public for unit tests. |
| 213 void set_remote_supports_renomination(bool remote_supports_renomination) { |
| 214 remote_supports_renomination_ = remote_supports_renomination; |
| 215 } |
| 216 |
212 private: | 217 private: |
213 rtc::Thread* thread() const { return worker_thread_; } | 218 rtc::Thread* thread() const { return worker_thread_; } |
214 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } | 219 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } |
215 | 220 |
216 // A transport channel is weak if the current best connection is either | 221 // A transport channel is weak if the current best connection is either |
217 // not receiving or not writable, or if there is no best connection at all. | 222 // not receiving or not writable, or if there is no best connection at all. |
218 bool weak() const; | 223 bool weak() const; |
219 // Returns true if it's possible to send packets on this channel. | 224 // Returns true if it's possible to send packets on this channel. |
220 bool ReadyToSend() const; | 225 bool ReadyToSend() const; |
221 void UpdateConnectionStates(); | 226 void UpdateConnectionStates(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 void OnSentPacket(const rtc::SentPacket& sent_packet); | 311 void OnSentPacket(const rtc::SentPacket& sent_packet); |
307 void OnReadyToSend(Connection* connection); | 312 void OnReadyToSend(Connection* connection); |
308 void OnConnectionDestroyed(Connection *connection); | 313 void OnConnectionDestroyed(Connection *connection); |
309 | 314 |
310 void OnNominated(Connection* conn); | 315 void OnNominated(Connection* conn); |
311 | 316 |
312 void OnMessage(rtc::Message* pmsg) override; | 317 void OnMessage(rtc::Message* pmsg) override; |
313 void OnCheckAndPing(); | 318 void OnCheckAndPing(); |
314 void OnRegatherOnFailedNetworks(); | 319 void OnRegatherOnFailedNetworks(); |
315 | 320 |
| 321 uint32_t GetNominationAttr(Connection* conn) const; |
| 322 bool GetUseCandidateAttr(Connection* conn, NominationMode mode) const; |
| 323 |
316 // Returns true if we should switch to the new connection. | 324 // Returns true if we should switch to the new connection. |
317 // sets |missed_receiving_unchanged_threshold| to true if either | 325 // sets |missed_receiving_unchanged_threshold| to true if either |
318 // the selected connection or the new connection missed its | 326 // the selected connection or the new connection missed its |
319 // receiving-unchanged-threshold. | 327 // receiving-unchanged-threshold. |
320 bool ShouldSwitchSelectedConnection( | 328 bool ShouldSwitchSelectedConnection( |
321 Connection* new_connection, | 329 Connection* new_connection, |
322 bool* missed_receiving_unchanged_threshold) const; | 330 bool* missed_receiving_unchanged_threshold) const; |
323 // Returns true if the new_connection is selected for transmission. | 331 // Returns true if the new_connection is selected for transmission. |
324 bool MaybeSwitchSelectedConnection(Connection* new_connection, | 332 bool MaybeSwitchSelectedConnection(Connection* new_connection, |
325 const std::string& reason); | 333 const std::string& reason); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 uint64_t tiebreaker_; | 403 uint64_t tiebreaker_; |
396 IceGatheringState gathering_state_; | 404 IceGatheringState gathering_state_; |
397 | 405 |
398 int check_receiving_interval_; | 406 int check_receiving_interval_; |
399 int64_t last_ping_sent_ms_ = 0; | 407 int64_t last_ping_sent_ms_ = 0; |
400 int weak_ping_interval_ = WEAK_PING_INTERVAL; | 408 int weak_ping_interval_ = WEAK_PING_INTERVAL; |
401 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 409 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
402 IceConfig config_; | 410 IceConfig config_; |
403 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 411 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
404 bool started_pinging_ = false; | 412 bool started_pinging_ = false; |
| 413 // TODO(honghaiz): Put this and ICE role inside ICEParameters and rename this |
| 414 // as renomination. Set its value in subsequent CLs based on signaling |
| 415 // exchange. |
| 416 bool remote_supports_renomination_ = false; |
| 417 // The value put in the "nomination" attribute for the next nominated |
| 418 // connection. A zero-value indicates the connection will not be nominated. |
| 419 uint32_t nomination_ = 0; |
405 | 420 |
406 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 421 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
407 }; | 422 }; |
408 | 423 |
409 } // namespace cricket | 424 } // namespace cricket |
410 | 425 |
411 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 426 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |