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

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

Issue 2069493002: Do not switch best connection on the controlled side too frequently (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge with head 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
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void set_component(int component) { component_ = component; } 171 void set_component(int component) { component_ = component; }
172 172
173 bool send_retransmit_count_attribute() const { 173 bool send_retransmit_count_attribute() const {
174 return send_retransmit_count_attribute_; 174 return send_retransmit_count_attribute_;
175 } 175 }
176 void set_send_retransmit_count_attribute(bool enable) { 176 void set_send_retransmit_count_attribute(bool enable) {
177 send_retransmit_count_attribute_ = enable; 177 send_retransmit_count_attribute_ = enable;
178 } 178 }
179 179
180 // Identifies the generation that this port was created in. 180 // Identifies the generation that this port was created in.
181 uint32_t generation() { return generation_; } 181 uint32_t generation() const { return generation_; }
182 void set_generation(uint32_t generation) { generation_ = generation; } 182 void set_generation(uint32_t generation) { generation_ = generation; }
183 183
184 const std::string username_fragment() const; 184 const std::string username_fragment() const;
185 const std::string& password() const { return password_; } 185 const std::string& password() const { return password_; }
186 186
187 // May be called when this port was initially created by a pooled 187 // May be called when this port was initially created by a pooled
188 // PortAllocatorSession, and is now being assigned to an ICE transport. 188 // PortAllocatorSession, and is now being assigned to an ICE transport.
189 // Updates the information for candidates as well. 189 // Updates the information for candidates as well.
190 void SetIceParameters(int component, 190 void SetIceParameters(int component,
191 const std::string& username_fragment, 191 const std::string& username_fragment,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 495
496 // Called when the socket is currently able to send. 496 // Called when the socket is currently able to send.
497 void OnReadyToSend(); 497 void OnReadyToSend();
498 498
499 // Called when a connection is determined to be no longer useful to us. We 499 // Called when a connection is determined to be no longer useful to us. We
500 // still keep it around in case the other side wants to use it. But we can 500 // still keep it around in case the other side wants to use it. But we can
501 // safely stop pinging on it and we can allow it to time out if the other 501 // safely stop pinging on it and we can allow it to time out if the other
502 // side stops using it as well. 502 // side stops using it as well.
503 bool pruned() const { return pruned_; } 503 bool pruned() const { return pruned_; }
504 void Prune(); 504 void Prune();
505 // Called when the state is WRITE_TIMEOUT but need to be reset and un-pruned.
506 void ResetWriteStateAndUnprune();
505 507
506 bool use_candidate_attr() const { return use_candidate_attr_; } 508 bool use_candidate_attr() const { return use_candidate_attr_; }
507 void set_use_candidate_attr(bool enable); 509 void set_use_candidate_attr(bool enable);
508 510
509 bool nominated() const { return nominated_; } 511 bool nominated() const { return nominated_; }
510 void set_nominated(bool nominated) { nominated_ = nominated; } 512 void set_nominated(bool nominated) { nominated_ = nominated; }
511 513
512 void set_remote_ice_mode(IceMode mode) { 514 void set_remote_ice_mode(IceMode mode) {
513 remote_ice_mode_ = mode; 515 remote_ice_mode_ = mode;
514 } 516 }
(...skipping 20 matching lines...) Expand all
535 return last_ping_response_received_; 537 return last_ping_response_received_;
536 } 538 }
537 539
538 // Called whenever a valid ping is received on this connection. This is 540 // Called whenever a valid ping is received on this connection. This is
539 // public because the connection intercepts the first ping for us. 541 // public because the connection intercepts the first ping for us.
540 int64_t last_ping_received() const { return last_ping_received_; } 542 int64_t last_ping_received() const { return last_ping_received_; }
541 void ReceivedPing(); 543 void ReceivedPing();
542 // Handles the binding request; sends a response if this is a valid request. 544 // Handles the binding request; sends a response if this is a valid request.
543 void HandleBindingRequest(IceMessage* msg); 545 void HandleBindingRequest(IceMessage* msg);
544 546
547 int64_t last_data_received() const { return last_data_received_; }
548
545 // Debugging description of this connection 549 // Debugging description of this connection
546 std::string ToDebugId() const; 550 std::string ToDebugId() const;
547 std::string ToString() const; 551 std::string ToString() const;
548 std::string ToSensitiveString() const; 552 std::string ToSensitiveString() const;
549 // Prints pings_since_last_response_ into a string. 553 // Prints pings_since_last_response_ into a string.
550 void PrintPingsSinceLastResponse(std::string* pings, size_t max); 554 void PrintPingsSinceLastResponse(std::string* pings, size_t max);
551 555
552 bool reported() const { return reported_; } 556 bool reported() const { return reported_; }
553 void set_reported(bool reported) { reported_ = reported;} 557 void set_reported(bool reported) { reported_ = reported;}
554 558
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 const rtc::PacketOptions& options) override; 678 const rtc::PacketOptions& options) override;
675 int GetError() override { return error_; } 679 int GetError() override { return error_; }
676 680
677 private: 681 private:
678 int error_ = 0; 682 int error_ = 0;
679 }; 683 };
680 684
681 } // namespace cricket 685 } // namespace cricket
682 686
683 #endif // WEBRTC_P2P_BASE_PORT_H_ 687 #endif // WEBRTC_P2P_BASE_PORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698