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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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() { |
| 507 write_state_ = STATE_WRITE_INIT; |
| 508 if (pruned_) { |
| 509 pruned_ = false; |
| 510 } |
| 511 } |
505 | 512 |
506 bool use_candidate_attr() const { return use_candidate_attr_; } | 513 bool use_candidate_attr() const { return use_candidate_attr_; } |
507 void set_use_candidate_attr(bool enable); | 514 void set_use_candidate_attr(bool enable); |
508 | 515 |
509 bool nominated() const { return nominated_; } | 516 bool nominated() const { return nominated_; } |
510 void set_nominated(bool nominated) { nominated_ = nominated; } | 517 void set_nominated(bool nominated) { nominated_ = nominated; } |
511 | 518 |
512 void set_remote_ice_mode(IceMode mode) { | 519 void set_remote_ice_mode(IceMode mode) { |
513 remote_ice_mode_ = mode; | 520 remote_ice_mode_ = mode; |
514 } | 521 } |
(...skipping 20 matching lines...) Expand all Loading... |
535 return last_ping_response_received_; | 542 return last_ping_response_received_; |
536 } | 543 } |
537 | 544 |
538 // Called whenever a valid ping is received on this connection. This is | 545 // Called whenever a valid ping is received on this connection. This is |
539 // public because the connection intercepts the first ping for us. | 546 // public because the connection intercepts the first ping for us. |
540 int64_t last_ping_received() const { return last_ping_received_; } | 547 int64_t last_ping_received() const { return last_ping_received_; } |
541 void ReceivedPing(); | 548 void ReceivedPing(); |
542 // Handles the binding request; sends a response if this is a valid request. | 549 // Handles the binding request; sends a response if this is a valid request. |
543 void HandleBindingRequest(IceMessage* msg); | 550 void HandleBindingRequest(IceMessage* msg); |
544 | 551 |
| 552 int64_t last_data_received() const { return last_data_received_; } |
| 553 |
545 // Debugging description of this connection | 554 // Debugging description of this connection |
546 std::string ToDebugId() const; | 555 std::string ToDebugId() const; |
547 std::string ToString() const; | 556 std::string ToString() const; |
548 std::string ToSensitiveString() const; | 557 std::string ToSensitiveString() const; |
549 // Prints pings_since_last_response_ into a string. | 558 // Prints pings_since_last_response_ into a string. |
550 void PrintPingsSinceLastResponse(std::string* pings, size_t max); | 559 void PrintPingsSinceLastResponse(std::string* pings, size_t max); |
551 | 560 |
552 bool reported() const { return reported_; } | 561 bool reported() const { return reported_; } |
553 void set_reported(bool reported) { reported_ = reported;} | 562 void set_reported(bool reported) { reported_ = reported;} |
554 | 563 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ |
OLD | NEW |