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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 PortInterface* origin_port); | 269 PortInterface* origin_port); |
270 bool IsPingable(const Connection* conn, int64_t now) const; | 270 bool IsPingable(const Connection* conn, int64_t now) const; |
271 bool IsSelectedConnectionPingable(int64_t now); | 271 bool IsSelectedConnectionPingable(int64_t now); |
272 int CalculateActiveWritablePingInterval(const Connection* conn, | 272 int CalculateActiveWritablePingInterval(const Connection* conn, |
273 int64_t now) const; | 273 int64_t now) const; |
274 void PingConnection(Connection* conn); | 274 void PingConnection(Connection* conn); |
275 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); | 275 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); |
276 void AddConnection(Connection* connection); | 276 void AddConnection(Connection* connection); |
277 | 277 |
278 void OnPortReady(PortAllocatorSession *session, PortInterface* port); | 278 void OnPortReady(PortAllocatorSession *session, PortInterface* port); |
279 // TODO(honghaiz): Merge the two methods OnPortsRemoved and OnPortPruned but | 279 void OnPortsPruned(PortAllocatorSession* session, |
280 // still log the reason of removing. | 280 const std::vector<PortInterface*>& ports); |
281 void OnPortsRemoved(PortAllocatorSession* session, | |
282 const std::vector<PortInterface*>& ports); | |
283 void OnPortPruned(PortAllocatorSession* session, PortInterface* port); | |
284 void OnCandidatesReady(PortAllocatorSession *session, | 281 void OnCandidatesReady(PortAllocatorSession *session, |
285 const std::vector<Candidate>& candidates); | 282 const std::vector<Candidate>& candidates); |
286 void OnCandidatesRemoved(PortAllocatorSession* session, | 283 void OnCandidatesRemoved(PortAllocatorSession* session, |
287 const std::vector<Candidate>& candidates); | 284 const std::vector<Candidate>& candidates); |
288 void OnCandidatesAllocationDone(PortAllocatorSession* session); | 285 void OnCandidatesAllocationDone(PortAllocatorSession* session); |
289 void OnUnknownAddress(PortInterface* port, | 286 void OnUnknownAddress(PortInterface* port, |
290 const rtc::SocketAddress& addr, | 287 const rtc::SocketAddress& addr, |
291 ProtocolType proto, | 288 ProtocolType proto, |
292 IceMessage* stun_msg, | 289 IceMessage* stun_msg, |
293 const std::string& remote_username, | 290 const std::string& remote_username, |
294 bool port_muxed); | 291 bool port_muxed); |
295 | 292 |
296 // When a port is destroyed, remove it from both lists |ports_| | 293 // When a port is destroyed, remove it from both lists |ports_| |
297 // and |removed_ports_|. | 294 // and |pruned_ports_|. |
298 void OnPortDestroyed(PortInterface* port); | 295 void OnPortDestroyed(PortInterface* port); |
299 // When removing a port, move it from |ports_| to |removed_ports_|. | 296 // When pruning a port, move it from |ports_| to |pruned_ports_|. |
300 // Returns true if the port is found and removed from |ports_|. | 297 // Returns true if the port is found and removed from |ports_|. |
301 bool RemovePort(PortInterface* port); | 298 bool OnPortPruned(PortInterface* port); |
302 void OnRoleConflict(PortInterface* port); | 299 void OnRoleConflict(PortInterface* port); |
303 | 300 |
304 void OnConnectionStateChange(Connection* connection); | 301 void OnConnectionStateChange(Connection* connection); |
305 void OnReadPacket(Connection *connection, const char *data, size_t len, | 302 void OnReadPacket(Connection *connection, const char *data, size_t len, |
306 const rtc::PacketTime& packet_time); | 303 const rtc::PacketTime& packet_time); |
307 void OnSentPacket(const rtc::SentPacket& sent_packet); | 304 void OnSentPacket(const rtc::SentPacket& sent_packet); |
308 void OnReadyToSend(Connection* connection); | 305 void OnReadyToSend(Connection* connection); |
309 void OnConnectionDestroyed(Connection *connection); | 306 void OnConnectionDestroyed(Connection *connection); |
310 | 307 |
311 void OnNominated(Connection* conn); | 308 void OnNominated(Connection* conn); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 356 } |
360 | 357 |
361 PortAllocator* allocator_; | 358 PortAllocator* allocator_; |
362 rtc::Thread* worker_thread_; | 359 rtc::Thread* worker_thread_; |
363 bool incoming_only_; | 360 bool incoming_only_; |
364 int error_; | 361 int error_; |
365 std::vector<std::unique_ptr<PortAllocatorSession>> allocator_sessions_; | 362 std::vector<std::unique_ptr<PortAllocatorSession>> allocator_sessions_; |
366 // |ports_| contains ports that are used to form new connections when | 363 // |ports_| contains ports that are used to form new connections when |
367 // new remote candidates are added. | 364 // new remote candidates are added. |
368 std::vector<PortInterface*> ports_; | 365 std::vector<PortInterface*> ports_; |
369 // |removed_ports_| contains ports that have been removed from |ports_| and | 366 // |pruned_ports_| contains ports that have been removed from |ports_| and |
370 // are not being used to form new connections, but that aren't yet destroyed. | 367 // are not being used to form new connections, but that aren't yet destroyed. |
371 // They may have existing connections, and they still fire signals such as | 368 // They may have existing connections, and they still fire signals such as |
372 // SignalUnknownAddress. | 369 // SignalUnknownAddress. |
373 std::vector<PortInterface*> removed_ports_; | 370 std::vector<PortInterface*> pruned_ports_; |
374 | 371 |
375 // |connections_| is a sorted list with the first one always be the | 372 // |connections_| is a sorted list with the first one always be the |
376 // |selected_connection_| when it's not nullptr. The combination of | 373 // |selected_connection_| when it's not nullptr. The combination of |
377 // |pinged_connections_| and |unpinged_connections_| has the same | 374 // |pinged_connections_| and |unpinged_connections_| has the same |
378 // connections as |connections_|. These 2 sets maintain whether a | 375 // connections as |connections_|. These 2 sets maintain whether a |
379 // connection should be pinged next or not. | 376 // connection should be pinged next or not. |
380 std::vector<Connection *> connections_; | 377 std::vector<Connection *> connections_; |
381 std::set<Connection*> pinged_connections_; | 378 std::set<Connection*> pinged_connections_; |
382 std::set<Connection*> unpinged_connections_; | 379 std::set<Connection*> unpinged_connections_; |
383 | 380 |
(...skipping 19 matching lines...) Expand all Loading... |
403 IceConfig config_; | 400 IceConfig config_; |
404 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 401 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
405 bool started_pinging_ = false; | 402 bool started_pinging_ = false; |
406 | 403 |
407 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 404 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
408 }; | 405 }; |
409 | 406 |
410 } // namespace cricket | 407 } // namespace cricket |
411 | 408 |
412 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 409 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |