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

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

Issue 1944003002: Increase the stun ping interval. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix naming issue in unit test before committing. Created 4 years, 6 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 | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // Makes the connection go away, in a failed state. 523 // Makes the connection go away, in a failed state.
524 void FailAndDestroy(); 524 void FailAndDestroy();
525 525
526 // Checks that the state of this connection is up-to-date. The argument is 526 // Checks that the state of this connection is up-to-date. The argument is
527 // the current time, which is compared against various timeouts. 527 // the current time, which is compared against various timeouts.
528 void UpdateState(int64_t now); 528 void UpdateState(int64_t now);
529 529
530 // Called when this connection should try checking writability again. 530 // Called when this connection should try checking writability again.
531 int64_t last_ping_sent() const { return last_ping_sent_; } 531 int64_t last_ping_sent() const { return last_ping_sent_; }
532 void Ping(int64_t now); 532 void Ping(int64_t now);
533 void ReceivedPingResponse(); 533 void ReceivedPingResponse(int rtt);
534 int64_t last_ping_response_received() const { 534 int64_t last_ping_response_received() const {
535 return last_ping_response_received_; 535 return last_ping_response_received_;
536 } 536 }
537 537
538 // Called whenever a valid ping is received on this connection. This is 538 // Called whenever a valid ping is received on this connection. This is
539 // public because the connection intercepts the first ping for us. 539 // public because the connection intercepts the first ping for us.
540 int64_t last_ping_received() const { return last_ping_received_; } 540 int64_t last_ping_received() const { return last_ping_received_; }
541 void ReceivedPing(); 541 void ReceivedPing();
542 // Handles the binding request; sends a response if this is a valid request. 542 // Handles the binding request; sends a response if this is a valid request.
543 void HandleBindingRequest(IceMessage* msg); 543 void HandleBindingRequest(IceMessage* msg);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 578
579 // If |remote_candidate_| is peer reflexive and is equivalent to 579 // If |remote_candidate_| is peer reflexive and is equivalent to
580 // |new_candidate| except the type, update |remote_candidate_| to 580 // |new_candidate| except the type, update |remote_candidate_| to
581 // |new_candidate|. 581 // |new_candidate|.
582 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate); 582 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate);
583 583
584 // Returns the last received time of any data, stun request, or stun 584 // Returns the last received time of any data, stun request, or stun
585 // response in milliseconds 585 // response in milliseconds
586 int64_t last_received() const; 586 int64_t last_received() const;
587 587
588 bool stable(int64_t now);
589
588 protected: 590 protected:
589 enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE }; 591 enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE };
590 592
591 // Constructs a new connection to the given remote port. 593 // Constructs a new connection to the given remote port.
592 Connection(Port* port, size_t index, const Candidate& candidate); 594 Connection(Port* port, size_t index, const Candidate& candidate);
593 595
594 // Called back when StunRequestManager has a stun packet to send 596 // Called back when StunRequestManager has a stun packet to send
595 void OnSendStunPacket(const void* data, size_t size, StunRequest* req); 597 void OnSendStunPacket(const void* data, size_t size, StunRequest* req);
596 598
597 // Callbacks from ConnectionRequest 599 // Callbacks from ConnectionRequest
598 virtual void OnConnectionRequestResponse(ConnectionRequest* req, 600 virtual void OnConnectionRequestResponse(ConnectionRequest* req,
599 StunMessage* response); 601 StunMessage* response);
600 void OnConnectionRequestErrorResponse(ConnectionRequest* req, 602 void OnConnectionRequestErrorResponse(ConnectionRequest* req,
601 StunMessage* response); 603 StunMessage* response);
602 void OnConnectionRequestTimeout(ConnectionRequest* req); 604 void OnConnectionRequestTimeout(ConnectionRequest* req);
603 void OnConnectionRequestSent(ConnectionRequest* req); 605 void OnConnectionRequestSent(ConnectionRequest* req);
604 606
607 bool rtt_converged();
608
609 // If the response is not received within 2 * RTT, the response is assumed to
610 // be missing.
611 bool missing_responses(int64_t now);
612
605 // Changes the state and signals if necessary. 613 // Changes the state and signals if necessary.
606 void set_write_state(WriteState value); 614 void set_write_state(WriteState value);
607 void set_receiving(bool value); 615 void set_receiving(bool value);
608 void set_state(State state); 616 void set_state(State state);
609 void set_connected(bool value); 617 void set_connected(bool value);
610 618
611 void OnMessage(rtc::Message *pmsg); 619 void OnMessage(rtc::Message *pmsg);
612 620
613 Port* port_; 621 Port* port_;
614 size_t local_candidate_index_; 622 size_t local_candidate_index_;
615 Candidate remote_candidate_; 623 Candidate remote_candidate_;
616 WriteState write_state_; 624 WriteState write_state_;
617 bool receiving_; 625 bool receiving_;
618 bool connected_; 626 bool connected_;
619 bool pruned_; 627 bool pruned_;
620 // By default |use_candidate_attr_| flag will be true, 628 // By default |use_candidate_attr_| flag will be true,
621 // as we will be using aggressive nomination. 629 // as we will be using aggressive nomination.
622 // But when peer is ice-lite, this flag "must" be initialized to false and 630 // But when peer is ice-lite, this flag "must" be initialized to false and
623 // turn on when connection becomes "best connection". 631 // turn on when connection becomes "best connection".
624 bool use_candidate_attr_; 632 bool use_candidate_attr_;
625 // Whether this connection has been nominated by the controlling side via 633 // Whether this connection has been nominated by the controlling side via
626 // the use_candidate attribute. 634 // the use_candidate attribute.
627 bool nominated_; 635 bool nominated_;
628 IceMode remote_ice_mode_; 636 IceMode remote_ice_mode_;
629 StunRequestManager requests_; 637 StunRequestManager requests_;
630 int rtt_; 638 int rtt_;
639 int rtt_samples_ = 0;
631 int64_t last_ping_sent_; // last time we sent a ping to the other side 640 int64_t last_ping_sent_; // last time we sent a ping to the other side
632 int64_t last_ping_received_; // last time we received a ping from the other 641 int64_t last_ping_received_; // last time we received a ping from the other
633 // side 642 // side
634 int64_t last_data_received_; 643 int64_t last_data_received_;
635 int64_t last_ping_response_received_; 644 int64_t last_ping_response_received_;
636 std::vector<SentPing> pings_since_last_response_; 645 std::vector<SentPing> pings_since_last_response_;
637 646
638 rtc::RateTracker recv_rate_tracker_; 647 rtc::RateTracker recv_rate_tracker_;
639 rtc::RateTracker send_rate_tracker_; 648 rtc::RateTracker send_rate_tracker_;
640 649
(...skipping 24 matching lines...) Expand all
665 const rtc::PacketOptions& options) override; 674 const rtc::PacketOptions& options) override;
666 int GetError() override { return error_; } 675 int GetError() override { return error_; }
667 676
668 private: 677 private:
669 int error_ = 0; 678 int error_ = 0;
670 }; 679 };
671 680
672 } // namespace cricket 681 } // namespace cricket
673 682
674 #endif // WEBRTC_P2P_BASE_PORT_H_ 683 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel_unittest.cc ('k') | webrtc/p2p/base/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698