| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void MaybeStartGathering() override; | 97 void MaybeStartGathering() override; |
| 98 IceGatheringState gathering_state() const override { | 98 IceGatheringState gathering_state() const override { |
| 99 return gathering_state_; | 99 return gathering_state_; |
| 100 } | 100 } |
| 101 void AddRemoteCandidate(const Candidate& candidate) override; | 101 void AddRemoteCandidate(const Candidate& candidate) override; |
| 102 void RemoveRemoteCandidate(const Candidate& candidate) override; | 102 void RemoveRemoteCandidate(const Candidate& candidate) override; |
| 103 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we | 103 // Sets the parameters in IceConfig. We do not set them blindly. Instead, we |
| 104 // only update the parameter if it is considered set in |config|. For example, | 104 // only update the parameter if it is considered set in |config|. For example, |
| 105 // a negative value of receiving_timeout will be considered "not set" and we | 105 // a negative value of receiving_timeout will be considered "not set" and we |
| 106 // will not use it to update the respective parameter in |config_|. | 106 // will not use it to update the respective parameter in |config_|. |
| 107 // TODO(deadbeef): Use rtc::Optional instead of negative values. | |
| 108 void SetIceConfig(const IceConfig& config) override; | 107 void SetIceConfig(const IceConfig& config) override; |
| 109 const IceConfig& config() const; | 108 const IceConfig& config() const; |
| 110 | 109 |
| 111 // From TransportChannel: | 110 // From TransportChannel: |
| 112 int SendPacket(const char* data, | 111 int SendPacket(const char* data, |
| 113 size_t len, | 112 size_t len, |
| 114 const rtc::PacketOptions& options, | 113 const rtc::PacketOptions& options, |
| 115 int flags) override; | 114 int flags) override; |
| 116 int SetOption(rtc::Socket::Option opt, int value) override; | 115 int SetOption(rtc::Socket::Option opt, int value) override; |
| 117 bool GetOption(rtc::Socket::Option opt, int* value) override; | 116 bool GetOption(rtc::Socket::Option opt, int* value) override; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 private: | 203 private: |
| 205 rtc::Thread* thread() { return worker_thread_; } | 204 rtc::Thread* thread() { return worker_thread_; } |
| 206 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } | 205 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } |
| 207 | 206 |
| 208 // A transport channel is weak if the current best connection is either | 207 // A transport channel is weak if the current best connection is either |
| 209 // not receiving or not writable, or if there is no best connection at all. | 208 // not receiving or not writable, or if there is no best connection at all. |
| 210 bool weak() const; | 209 bool weak() const; |
| 211 void UpdateConnectionStates(); | 210 void UpdateConnectionStates(); |
| 212 void RequestSort(); | 211 void RequestSort(); |
| 213 | |
| 214 // The methods below return a positive value if a is preferable to b, | |
| 215 // a negative value if b is preferable, and 0 if they're equally preferable. | |
| 216 int CompareConnectionStates(const cricket::Connection* a, | |
| 217 const cricket::Connection* b) const; | |
| 218 int CompareConnectionCandidates(const cricket::Connection* a, | |
| 219 const cricket::Connection* b) const; | |
| 220 // Compares first on states, then on candidates, then on RTT. | |
| 221 int CompareConnections(const cricket::Connection* a, | |
| 222 const cricket::Connection* b) const; | |
| 223 bool PresumedWritable(const cricket::Connection* conn) const; | |
| 224 | |
| 225 bool ShouldSwitchSelectedConnection(const cricket::Connection* selected, | |
| 226 const cricket::Connection* conn) const; | |
| 227 void SortConnections(); | 212 void SortConnections(); |
| 228 void SwitchBestConnectionTo(Connection* conn); | 213 void SwitchBestConnectionTo(Connection* conn); |
| 229 void UpdateState(); | 214 void UpdateState(); |
| 230 void HandleAllTimedOut(); | 215 void HandleAllTimedOut(); |
| 231 void MaybeStopPortAllocatorSessions(); | 216 void MaybeStopPortAllocatorSessions(); |
| 232 TransportChannelState ComputeState() const; | 217 TransportChannelState ComputeState() const; |
| 233 | 218 |
| 234 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; | 219 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; |
| 235 bool CreateConnections(const Candidate& remote_candidate, | 220 bool CreateConnections(const Candidate& remote_candidate, |
| 236 PortInterface* origin_port); | 221 PortInterface* origin_port); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 343 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
| 359 IceConfig config_; | 344 IceConfig config_; |
| 360 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 345 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
| 361 | 346 |
| 362 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 347 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
| 363 }; | 348 }; |
| 364 | 349 |
| 365 } // namespace cricket | 350 } // namespace cricket |
| 366 | 351 |
| 367 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 352 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
| OLD | NEW |