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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // A transport channel is weak if the current best connection is either | 173 // A transport channel is weak if the current best connection is either |
174 // not receiving or not writable, or if there is no best connection at all. | 174 // not receiving or not writable, or if there is no best connection at all. |
175 bool weak() const; | 175 bool weak() const; |
176 void UpdateConnectionStates(); | 176 void UpdateConnectionStates(); |
177 void RequestSort(); | 177 void RequestSort(); |
178 void SortConnections(); | 178 void SortConnections(); |
179 void SwitchBestConnectionTo(Connection* conn); | 179 void SwitchBestConnectionTo(Connection* conn); |
180 void UpdateChannelState(); | 180 void UpdateChannelState(); |
181 void HandleAllTimedOut(); | 181 void HandleAllTimedOut(); |
182 void MaybeStopPortAllocatorSessions(); | 182 void MaybeStopPortAllocatorSessions(); |
| 183 TransportChannelState ComputeState() const; |
183 | 184 |
184 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; | 185 Connection* GetBestConnectionOnNetwork(rtc::Network* network) const; |
185 bool CreateConnections(const Candidate& remote_candidate, | 186 bool CreateConnections(const Candidate& remote_candidate, |
186 PortInterface* origin_port); | 187 PortInterface* origin_port); |
187 bool CreateConnection(PortInterface* port, | 188 bool CreateConnection(PortInterface* port, |
188 const Candidate& remote_candidate, | 189 const Candidate& remote_candidate, |
189 PortInterface* origin_port); | 190 PortInterface* origin_port); |
190 bool FindConnection(cricket::Connection* connection) const; | 191 bool FindConnection(cricket::Connection* connection) const; |
191 | 192 |
192 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); | 193 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); |
193 bool IsDuplicateRemoteCandidate(const Candidate& candidate); | 194 bool IsDuplicateRemoteCandidate(const Candidate& candidate); |
194 void RememberRemoteCandidate(const Candidate& remote_candidate, | 195 void RememberRemoteCandidate(const Candidate& remote_candidate, |
195 PortInterface* origin_port); | 196 PortInterface* origin_port); |
196 bool IsPingable(Connection* conn); | 197 bool IsPingable(Connection* conn, uint32_t now); |
197 void PingConnection(Connection* conn); | 198 void PingConnection(Connection* conn); |
198 void AddAllocatorSession(PortAllocatorSession* session); | 199 void AddAllocatorSession(PortAllocatorSession* session); |
199 void AddConnection(Connection* connection); | 200 void AddConnection(Connection* connection); |
200 | 201 |
201 void OnPortReady(PortAllocatorSession *session, PortInterface* port); | 202 void OnPortReady(PortAllocatorSession *session, PortInterface* port); |
202 void OnCandidatesReady(PortAllocatorSession *session, | 203 void OnCandidatesReady(PortAllocatorSession *session, |
203 const std::vector<Candidate>& candidates); | 204 const std::vector<Candidate>& candidates); |
204 void OnCandidatesAllocationDone(PortAllocatorSession* session); | 205 void OnCandidatesAllocationDone(PortAllocatorSession* session); |
205 void OnUnknownAddress(PortInterface* port, | 206 void OnUnknownAddress(PortInterface* port, |
206 const rtc::SocketAddress& addr, | 207 const rtc::SocketAddress& addr, |
(...skipping 12 matching lines...) Expand all Loading... |
219 void OnConnectionDestroyed(Connection *connection); | 220 void OnConnectionDestroyed(Connection *connection); |
220 | 221 |
221 void OnNominated(Connection* conn); | 222 void OnNominated(Connection* conn); |
222 | 223 |
223 void OnMessage(rtc::Message* pmsg) override; | 224 void OnMessage(rtc::Message* pmsg) override; |
224 void OnSort(); | 225 void OnSort(); |
225 void OnCheckAndPing(); | 226 void OnCheckAndPing(); |
226 | 227 |
227 void PruneConnections(); | 228 void PruneConnections(); |
228 Connection* best_nominated_connection() const; | 229 Connection* best_nominated_connection() const; |
| 230 bool IsBackupConnection(Connection* conn) const; |
229 | 231 |
230 P2PTransport* transport_; | 232 P2PTransport* transport_; |
231 PortAllocator* allocator_; | 233 PortAllocator* allocator_; |
232 rtc::Thread* worker_thread_; | 234 rtc::Thread* worker_thread_; |
233 bool incoming_only_; | 235 bool incoming_only_; |
234 int error_; | 236 int error_; |
235 std::vector<PortAllocatorSession*> allocator_sessions_; | 237 std::vector<PortAllocatorSession*> allocator_sessions_; |
236 std::vector<PortInterface *> ports_; | 238 std::vector<PortInterface *> ports_; |
237 std::vector<Connection *> connections_; | 239 std::vector<Connection *> connections_; |
238 Connection* best_connection_; | 240 Connection* best_connection_; |
(...skipping 10 matching lines...) Expand all Loading... |
249 std::string remote_ice_ufrag_; | 251 std::string remote_ice_ufrag_; |
250 std::string remote_ice_pwd_; | 252 std::string remote_ice_pwd_; |
251 IceMode remote_ice_mode_; | 253 IceMode remote_ice_mode_; |
252 IceRole ice_role_; | 254 IceRole ice_role_; |
253 uint64_t tiebreaker_; | 255 uint64_t tiebreaker_; |
254 uint32_t remote_candidate_generation_; | 256 uint32_t remote_candidate_generation_; |
255 IceGatheringState gathering_state_; | 257 IceGatheringState gathering_state_; |
256 | 258 |
257 int check_receiving_delay_; | 259 int check_receiving_delay_; |
258 int receiving_timeout_; | 260 int receiving_timeout_; |
| 261 int backup_connection_ping_interval_; |
259 uint32_t last_ping_sent_ms_ = 0; | 262 uint32_t last_ping_sent_ms_ = 0; |
260 bool gather_continually_ = false; | 263 bool gather_continually_ = false; |
261 int weak_ping_delay_ = WEAK_PING_DELAY; | 264 int weak_ping_delay_ = WEAK_PING_DELAY; |
| 265 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
262 | 266 |
263 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 267 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
264 }; | 268 }; |
265 | 269 |
266 } // namespace cricket | 270 } // namespace cricket |
267 | 271 |
268 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 272 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |