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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Public for unit tests. | 183 // Public for unit tests. |
184 Connection* FindNextPingableConnection(); | 184 Connection* FindNextPingableConnection(); |
185 void MarkConnectionPinged(Connection* conn); | 185 void MarkConnectionPinged(Connection* conn); |
186 | 186 |
187 // Public for unit tests. | 187 // Public for unit tests. |
188 const std::vector<Connection*>& connections() const { return connections_; } | 188 const std::vector<Connection*>& connections() const { return connections_; } |
189 | 189 |
190 // Public for unit tests. | 190 // Public for unit tests. |
191 PortAllocatorSession* allocator_session() { | 191 PortAllocatorSession* allocator_session() { |
192 return allocator_sessions_.back().get(); | 192 return allocator_sessions_.back(); |
193 } | 193 } |
194 | 194 |
195 // Public for unit tests. | 195 // Public for unit tests. |
196 const std::vector<RemoteCandidate>& remote_candidates() const { | 196 const std::vector<RemoteCandidate>& remote_candidates() const { |
197 return remote_candidates_; | 197 return remote_candidates_; |
198 } | 198 } |
199 | 199 |
200 private: | 200 private: |
201 rtc::Thread* thread() { return worker_thread_; } | 201 rtc::Thread* thread() { return worker_thread_; } |
202 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } | 202 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } |
(...skipping 17 matching lines...) Expand all Loading... |
220 const Candidate& remote_candidate, | 220 const Candidate& remote_candidate, |
221 PortInterface* origin_port); | 221 PortInterface* origin_port); |
222 bool FindConnection(cricket::Connection* connection) const; | 222 bool FindConnection(cricket::Connection* connection) const; |
223 | 223 |
224 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); | 224 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); |
225 bool IsDuplicateRemoteCandidate(const Candidate& candidate); | 225 bool IsDuplicateRemoteCandidate(const Candidate& candidate); |
226 void RememberRemoteCandidate(const Candidate& remote_candidate, | 226 void RememberRemoteCandidate(const Candidate& remote_candidate, |
227 PortInterface* origin_port); | 227 PortInterface* origin_port); |
228 bool IsPingable(Connection* conn, int64_t now); | 228 bool IsPingable(Connection* conn, int64_t now); |
229 void PingConnection(Connection* conn); | 229 void PingConnection(Connection* conn); |
230 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); | 230 void AddAllocatorSession(PortAllocatorSession* session); |
231 void AddConnection(Connection* connection); | 231 void AddConnection(Connection* connection); |
232 | 232 |
233 void OnPortReady(PortAllocatorSession *session, PortInterface* port); | 233 void OnPortReady(PortAllocatorSession *session, PortInterface* port); |
234 void OnCandidatesReady(PortAllocatorSession *session, | 234 void OnCandidatesReady(PortAllocatorSession *session, |
235 const std::vector<Candidate>& candidates); | 235 const std::vector<Candidate>& candidates); |
236 void OnCandidatesAllocationDone(PortAllocatorSession* session); | 236 void OnCandidatesAllocationDone(PortAllocatorSession* session); |
237 void OnUnknownAddress(PortInterface* port, | 237 void OnUnknownAddress(PortInterface* port, |
238 const rtc::SocketAddress& addr, | 238 const rtc::SocketAddress& addr, |
239 ProtocolType proto, | 239 ProtocolType proto, |
240 IceMessage* stun_msg, | 240 IceMessage* stun_msg, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 uint32_t remote_ice_generation() { | 288 uint32_t remote_ice_generation() { |
289 return remote_ice_parameters_.empty() | 289 return remote_ice_parameters_.empty() |
290 ? 0 | 290 ? 0 |
291 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1); | 291 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1); |
292 } | 292 } |
293 | 293 |
294 PortAllocator* allocator_; | 294 PortAllocator* allocator_; |
295 rtc::Thread* worker_thread_; | 295 rtc::Thread* worker_thread_; |
296 bool incoming_only_; | 296 bool incoming_only_; |
297 int error_; | 297 int error_; |
298 std::vector<std::unique_ptr<PortAllocatorSession>> allocator_sessions_; | 298 std::vector<PortAllocatorSession*> allocator_sessions_; |
299 std::vector<PortInterface *> ports_; | 299 std::vector<PortInterface *> ports_; |
300 | 300 |
301 // |connections_| is a sorted list with the first one always be the | 301 // |connections_| is a sorted list with the first one always be the |
302 // |best_connection_| when it's not nullptr. The combination of | 302 // |best_connection_| when it's not nullptr. The combination of |
303 // |pinged_connections_| and |unpinged_connections_| has the same | 303 // |pinged_connections_| and |unpinged_connections_| has the same |
304 // connections as |connections_|. These 2 sets maintain whether a | 304 // connections as |connections_|. These 2 sets maintain whether a |
305 // connection should be pinged next or not. | 305 // connection should be pinged next or not. |
306 std::vector<Connection *> connections_; | 306 std::vector<Connection *> connections_; |
307 std::set<Connection*> pinged_connections_; | 307 std::set<Connection*> pinged_connections_; |
308 std::set<Connection*> unpinged_connections_; | 308 std::set<Connection*> unpinged_connections_; |
(...skipping 22 matching lines...) Expand all Loading... |
331 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 331 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
332 IceConfig config_; | 332 IceConfig config_; |
333 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 333 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
334 | 334 |
335 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 335 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
336 }; | 336 }; |
337 | 337 |
338 } // namespace cricket | 338 } // namespace cricket |
339 | 339 |
340 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 340 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |