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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 PortInterface* origin_port); | 261 PortInterface* origin_port); |
262 bool IsPingable(const Connection* conn, int64_t now) const; | 262 bool IsPingable(const Connection* conn, int64_t now) const; |
263 bool IsSelectedConnectionPingable(int64_t now); | 263 bool IsSelectedConnectionPingable(int64_t now); |
264 int CalculateActiveWritablePingInterval(const Connection* conn, | 264 int CalculateActiveWritablePingInterval(const Connection* conn, |
265 int64_t now) const; | 265 int64_t now) const; |
266 void PingConnection(Connection* conn); | 266 void PingConnection(Connection* conn); |
267 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); | 267 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); |
268 void AddConnection(Connection* connection); | 268 void AddConnection(Connection* connection); |
269 | 269 |
270 void OnPortReady(PortAllocatorSession *session, PortInterface* port); | 270 void OnPortReady(PortAllocatorSession *session, PortInterface* port); |
| 271 // TODO(honghaiz): Merge the two methods OnPortsRemoved and OnPortPruned but |
| 272 // still log the reason of removing. |
| 273 void OnPortsRemoved(PortAllocatorSession* session, |
| 274 const std::vector<PortInterface*>& ports); |
271 void OnPortPruned(PortAllocatorSession* session, PortInterface* port); | 275 void OnPortPruned(PortAllocatorSession* session, PortInterface* port); |
272 // Returns true if the port is found and removed from |ports_|. | |
273 bool RemovePort(PortInterface* port); | |
274 void OnCandidatesReady(PortAllocatorSession *session, | 276 void OnCandidatesReady(PortAllocatorSession *session, |
275 const std::vector<Candidate>& candidates); | 277 const std::vector<Candidate>& candidates); |
| 278 void OnCandidatesRemoved(PortAllocatorSession* session, |
| 279 const std::vector<Candidate>& candidates); |
276 void OnCandidatesAllocationDone(PortAllocatorSession* session); | 280 void OnCandidatesAllocationDone(PortAllocatorSession* session); |
277 void OnUnknownAddress(PortInterface* port, | 281 void OnUnknownAddress(PortInterface* port, |
278 const rtc::SocketAddress& addr, | 282 const rtc::SocketAddress& addr, |
279 ProtocolType proto, | 283 ProtocolType proto, |
280 IceMessage* stun_msg, | 284 IceMessage* stun_msg, |
281 const std::string& remote_username, | 285 const std::string& remote_username, |
282 bool port_muxed); | 286 bool port_muxed); |
| 287 |
| 288 // When a port is destroyed, remove it from both lists |ports_| |
| 289 // and |removed_ports_|. |
283 void OnPortDestroyed(PortInterface* port); | 290 void OnPortDestroyed(PortInterface* port); |
284 void OnPortNetworkInactive(PortInterface* port); | 291 // When removing a port, move it from |ports_| to |removed_ports_|. |
| 292 // Returns true if the port is found and removed from |ports_|. |
| 293 bool RemovePort(PortInterface* port); |
285 void OnRoleConflict(PortInterface* port); | 294 void OnRoleConflict(PortInterface* port); |
286 | 295 |
287 void OnConnectionStateChange(Connection* connection); | 296 void OnConnectionStateChange(Connection* connection); |
288 void OnReadPacket(Connection *connection, const char *data, size_t len, | 297 void OnReadPacket(Connection *connection, const char *data, size_t len, |
289 const rtc::PacketTime& packet_time); | 298 const rtc::PacketTime& packet_time); |
290 void OnSentPacket(const rtc::SentPacket& sent_packet); | 299 void OnSentPacket(const rtc::SentPacket& sent_packet); |
291 void OnReadyToSend(Connection* connection); | 300 void OnReadyToSend(Connection* connection); |
292 void OnConnectionDestroyed(Connection *connection); | 301 void OnConnectionDestroyed(Connection *connection); |
293 | 302 |
294 void OnNominated(Connection* conn); | 303 void OnNominated(Connection* conn); |
295 | 304 |
296 void OnMessage(rtc::Message* pmsg) override; | 305 void OnMessage(rtc::Message* pmsg) override; |
297 void OnCheckAndPing(); | 306 void OnCheckAndPing(); |
| 307 void OnRegatherOnFailedNetworks(); |
298 | 308 |
299 // Returns true if the new_connection should be selected for transmission. | 309 // Returns true if the new_connection should be selected for transmission. |
300 bool ShouldSwitchSelectedConnection(Connection* new_connection) const; | 310 bool ShouldSwitchSelectedConnection(Connection* new_connection) const; |
301 | 311 |
302 void PruneConnections(); | 312 void PruneConnections(); |
303 bool IsBackupConnection(const Connection* conn) const; | 313 bool IsBackupConnection(const Connection* conn) const; |
304 | 314 |
305 Connection* FindConnectionToPing(int64_t now); | 315 Connection* FindConnectionToPing(int64_t now); |
306 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now); | 316 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now); |
307 // Between |conn1| and |conn2|, this function returns the one which should | 317 // Between |conn1| and |conn2|, this function returns the one which should |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 IceConfig config_; | 387 IceConfig config_; |
378 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. | 388 int last_sent_packet_id_ = -1; // -1 indicates no packet was sent before. |
379 bool started_pinging_ = false; | 389 bool started_pinging_ = false; |
380 | 390 |
381 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 391 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
382 }; | 392 }; |
383 | 393 |
384 } // namespace cricket | 394 } // namespace cricket |
385 | 395 |
386 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 396 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |