Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: webrtc/p2p/base/port.h

Issue 2184013003: Delay destroying a port if new connections are created and destroyed. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/port.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // Called when the socket is currently able to send. 290 // Called when the socket is currently able to send.
291 void OnReadyToSend(); 291 void OnReadyToSend();
292 292
293 // Called when the Connection discovers a local peer reflexive candidate. 293 // Called when the Connection discovers a local peer reflexive candidate.
294 // Returns the index of the new local candidate. 294 // Returns the index of the new local candidate.
295 size_t AddPrflxCandidate(const Candidate& local); 295 size_t AddPrflxCandidate(const Candidate& local);
296 296
297 int16_t network_cost() const { return network_cost_; } 297 int16_t network_cost() const { return network_cost_; }
298 298
299 protected: 299 protected:
300 enum { 300 enum { MSG_CHECK_DEAD = 0, MSG_FIRST_AVAILABLE };
301 MSG_DEAD = 0,
302 MSG_FIRST_AVAILABLE
303 };
304 301
305 virtual void UpdateNetworkCost(); 302 virtual void UpdateNetworkCost();
306 303
307 void set_type(const std::string& type) { type_ = type; } 304 void set_type(const std::string& type) { type_ = type; }
308 305
309 void AddAddress(const rtc::SocketAddress& address, 306 void AddAddress(const rtc::SocketAddress& address,
310 const rtc::SocketAddress& base_address, 307 const rtc::SocketAddress& base_address,
311 const rtc::SocketAddress& related_address, 308 const rtc::SocketAddress& related_address,
312 const std::string& protocol, 309 const std::string& protocol,
313 const std::string& relay_protocol, 310 const std::string& relay_protocol,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Extra work to be done in subclasses when a connection is destroyed. 349 // Extra work to be done in subclasses when a connection is destroyed.
353 virtual void HandleConnectionDestroyed(Connection* conn) {} 350 virtual void HandleConnectionDestroyed(Connection* conn) {}
354 351
355 private: 352 private:
356 void Construct(); 353 void Construct();
357 // Called when one of our connections deletes itself. 354 // Called when one of our connections deletes itself.
358 void OnConnectionDestroyed(Connection* conn); 355 void OnConnectionDestroyed(Connection* conn);
359 356
360 // Whether this port is dead, and hence, should be destroyed on the controlled 357 // Whether this port is dead, and hence, should be destroyed on the controlled
361 // side. 358 // side.
362 bool dead() const { 359 bool dead() const;
363 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty();
364 }
365 360
366 void OnNetworkTypeChanged(const rtc::Network* network); 361 void OnNetworkTypeChanged(const rtc::Network* network);
367 362
368 rtc::Thread* thread_; 363 rtc::Thread* thread_;
369 rtc::PacketSocketFactory* factory_; 364 rtc::PacketSocketFactory* factory_;
370 std::string type_; 365 std::string type_;
371 bool send_retransmit_count_attribute_; 366 bool send_retransmit_count_attribute_;
372 rtc::Network* network_; 367 rtc::Network* network_;
373 rtc::IPAddress ip_; 368 rtc::IPAddress ip_;
374 uint16_t min_port_; 369 uint16_t min_port_;
(...skipping 19 matching lines...) Expand all
394 uint64_t tiebreaker_; 389 uint64_t tiebreaker_;
395 bool shared_socket_; 390 bool shared_socket_;
396 // Information to use when going through a proxy. 391 // Information to use when going through a proxy.
397 std::string user_agent_; 392 std::string user_agent_;
398 rtc::ProxyInfo proxy_; 393 rtc::ProxyInfo proxy_;
399 394
400 // A virtual cost perceived by the user, usually based on the network type 395 // A virtual cost perceived by the user, usually based on the network type
401 // (WiFi. vs. Cellular). It takes precedence over the priority when 396 // (WiFi. vs. Cellular). It takes precedence over the priority when
402 // comparing two connections. 397 // comparing two connections.
403 uint16_t network_cost_; 398 uint16_t network_cost_;
399 int64_t last_time_all_connections_removed_ = 0;
404 400
405 friend class Connection; 401 friend class Connection;
406 }; 402 };
407 403
408 // Represents a communication link between a port on the local client and a 404 // Represents a communication link between a port on the local client and a
409 // port on the remote client. 405 // port on the remote client.
410 class Connection : public CandidatePairInterface, 406 class Connection : public CandidatePairInterface,
411 public rtc::MessageHandler, 407 public rtc::MessageHandler,
412 public sigslot::has_slots<> { 408 public sigslot::has_slots<> {
413 public: 409 public:
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 const rtc::PacketOptions& options) override; 681 const rtc::PacketOptions& options) override;
686 int GetError() override { return error_; } 682 int GetError() override { return error_; }
687 683
688 private: 684 private:
689 int error_ = 0; 685 int error_ = 0;
690 }; 686 };
691 687
692 } // namespace cricket 688 } // namespace cricket
693 689
694 #endif // WEBRTC_P2P_BASE_PORT_H_ 690 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698