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

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

Issue 2143653005: Dampening connection switch. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add tests and fix an issue Created 4 years, 5 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
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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // This signal will be fired if this connection is nominated by the 561 // This signal will be fired if this connection is nominated by the
562 // controlling side. 562 // controlling side.
563 sigslot::signal1<Connection*> SignalNominated; 563 sigslot::signal1<Connection*> SignalNominated;
564 564
565 // Invoked when Connection receives STUN error response with 487 code. 565 // Invoked when Connection receives STUN error response with 487 code.
566 void HandleRoleConflictFromPeer(); 566 void HandleRoleConflictFromPeer();
567 567
568 State state() const { return state_; } 568 State state() const { return state_; }
569 569
570 int num_pings_sent() const { return num_pings_sent_; } 570 int num_pings_sent() const { return num_pings_sent_; }
571 void reset_num_pings_sent() { num_pings_sent_ = 0; }
571 572
572 IceMode remote_ice_mode() const { return remote_ice_mode_; } 573 IceMode remote_ice_mode() const { return remote_ice_mode_; }
573 574
574 uint32_t ComputeNetworkCost() const; 575 uint32_t ComputeNetworkCost() const;
575 576
576 // Update the ICE password and/or generation of the remote candidate if a 577 // Update the ICE password and/or generation of the remote candidate if a
577 // ufrag in |remote_ice_parameters| matches the candidate's ufrag, and the 578 // ufrag in |remote_ice_parameters| matches the candidate's ufrag, and the
578 // candidate's password and/or ufrag has not been set. 579 // candidate's password and/or ufrag has not been set.
579 // |remote_ice_parameters| should be a list of known ICE parameters ordered 580 // |remote_ice_parameters| should be a list of known ICE parameters ordered
580 // by generation. 581 // by generation.
581 void MaybeSetRemoteIceCredentialsAndGeneration(const std::string& ice_ufrag, 582 void MaybeSetRemoteIceCredentialsAndGeneration(const std::string& ice_ufrag,
582 const std::string& ice_pwd, 583 const std::string& ice_pwd,
583 int generation); 584 int generation);
584 585
585 // If |remote_candidate_| is peer reflexive and is equivalent to 586 // If |remote_candidate_| is peer reflexive and is equivalent to
586 // |new_candidate| except the type, update |remote_candidate_| to 587 // |new_candidate| except the type, update |remote_candidate_| to
587 // |new_candidate|. 588 // |new_candidate|.
588 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate); 589 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate);
589 590
590 // Returns the last received time of any data, stun request, or stun 591 // Returns the last received time of any data, stun request, or stun
591 // response in milliseconds 592 // response in milliseconds
592 int64_t last_received() const; 593 int64_t last_received() const;
594 // Returns the first received time of any packet since the last time the
595 // transport channel is weak.
pthatcher1 2016/07/13 21:17:22 is weak => was weakly connected
honghaiz3 2016/07/14 04:54:20 Method removed and replaced.
596 int64_t first_received_since_channel_weak() const {
597 return first_received_since_channel_weak_;
598 }
599
600 void reset_first_received_since_channel_weak() {
601 first_received_since_channel_weak_ = 0;
602 }
593 603
594 bool stable(int64_t now) const; 604 bool stable(int64_t now) const;
595 605
596 protected: 606 protected:
597 enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE }; 607 enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE };
598 608
599 // Constructs a new connection to the given remote port. 609 // Constructs a new connection to the given remote port.
600 Connection(Port* port, size_t index, const Candidate& candidate); 610 Connection(Port* port, size_t index, const Candidate& candidate);
601 611
602 // Called back when StunRequestManager has a stun packet to send 612 // Called back when StunRequestManager has a stun packet to send
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 bool nominated_; 651 bool nominated_;
642 IceMode remote_ice_mode_; 652 IceMode remote_ice_mode_;
643 StunRequestManager requests_; 653 StunRequestManager requests_;
644 int rtt_; 654 int rtt_;
645 int rtt_samples_ = 0; 655 int rtt_samples_ = 0;
646 int64_t last_ping_sent_; // last time we sent a ping to the other side 656 int64_t last_ping_sent_; // last time we sent a ping to the other side
647 int64_t last_ping_received_; // last time we received a ping from the other 657 int64_t last_ping_received_; // last time we received a ping from the other
648 // side 658 // side
649 int64_t last_data_received_; 659 int64_t last_data_received_;
650 int64_t last_ping_response_received_; 660 int64_t last_ping_response_received_;
661 int64_t first_received_since_channel_weak_ = 0;
651 std::vector<SentPing> pings_since_last_response_; 662 std::vector<SentPing> pings_since_last_response_;
652 663
653 rtc::RateTracker recv_rate_tracker_; 664 rtc::RateTracker recv_rate_tracker_;
654 rtc::RateTracker send_rate_tracker_; 665 rtc::RateTracker send_rate_tracker_;
655 666
656 ConnectionInfo stats_; 667 ConnectionInfo stats_;
657 668
658 private: 669 private:
659 void MaybeAddPrflxCandidate(ConnectionRequest* request, 670 void MaybeAddPrflxCandidate(ConnectionRequest* request,
660 StunMessage* response); 671 StunMessage* response);
(...skipping 19 matching lines...) Expand all
680 const rtc::PacketOptions& options) override; 691 const rtc::PacketOptions& options) override;
681 int GetError() override { return error_; } 692 int GetError() override { return error_; }
682 693
683 private: 694 private:
684 int error_ = 0; 695 int error_ = 0;
685 }; 696 };
686 697
687 } // namespace cricket 698 } // namespace cricket
688 699
689 #endif // WEBRTC_P2P_BASE_PORT_H_ 700 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698