| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 WriteState write_state() const { return write_state_; } | 440 WriteState write_state() const { return write_state_; } |
| 441 bool writable() const { return write_state_ == STATE_WRITABLE; } | 441 bool writable() const { return write_state_ == STATE_WRITABLE; } |
| 442 bool receiving() const { return receiving_; } | 442 bool receiving() const { return receiving_; } |
| 443 | 443 |
| 444 // Determines whether the connection has finished connecting. This can only | 444 // Determines whether the connection has finished connecting. This can only |
| 445 // be false for TCP connections. | 445 // be false for TCP connections. |
| 446 bool connected() const { return connected_; } | 446 bool connected() const { return connected_; } |
| 447 bool weak() const { return !(writable() && receiving() && connected()); } | 447 bool weak() const { return !(writable() && receiving() && connected()); } |
| 448 bool active() const { | 448 bool active() const { |
| 449 // TODO(honghaiz): Move from using |write_state_| to using |pruned_|. | |
| 450 return write_state_ != STATE_WRITE_TIMEOUT; | 449 return write_state_ != STATE_WRITE_TIMEOUT; |
| 451 } | 450 } |
| 452 // A connection is dead if it can be safely deleted. | 451 // A connection is dead if it can be safely deleted. |
| 453 bool dead(uint32_t now) const; | 452 bool dead(uint32_t now) const; |
| 454 | 453 |
| 455 // Estimate of the round-trip time over this connection. | 454 // Estimate of the round-trip time over this connection. |
| 456 uint32_t rtt() const { return rtt_; } | 455 uint32_t rtt() const { return rtt_; } |
| 457 | 456 |
| 458 size_t sent_total_bytes(); | 457 size_t sent_total_bytes(); |
| 459 size_t sent_bytes_second(); | 458 size_t sent_bytes_second(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void FailAndDestroy(); | 517 void FailAndDestroy(); |
| 519 | 518 |
| 520 // Checks that the state of this connection is up-to-date. The argument is | 519 // Checks that the state of this connection is up-to-date. The argument is |
| 521 // the current time, which is compared against various timeouts. | 520 // the current time, which is compared against various timeouts. |
| 522 void UpdateState(uint32_t now); | 521 void UpdateState(uint32_t now); |
| 523 | 522 |
| 524 // Called when this connection should try checking writability again. | 523 // Called when this connection should try checking writability again. |
| 525 uint32_t last_ping_sent() const { return last_ping_sent_; } | 524 uint32_t last_ping_sent() const { return last_ping_sent_; } |
| 526 void Ping(uint32_t now); | 525 void Ping(uint32_t now); |
| 527 void ReceivedPingResponse(); | 526 void ReceivedPingResponse(); |
| 527 uint32_t last_ping_response_received() const { |
| 528 return last_ping_response_received_; |
| 529 } |
| 528 | 530 |
| 529 // Called whenever a valid ping is received on this connection. This is | 531 // Called whenever a valid ping is received on this connection. This is |
| 530 // public because the connection intercepts the first ping for us. | 532 // public because the connection intercepts the first ping for us. |
| 531 uint32_t last_ping_received() const { return last_ping_received_; } | 533 uint32_t last_ping_received() const { return last_ping_received_; } |
| 532 void ReceivedPing(); | 534 void ReceivedPing(); |
| 533 // Handles the binding request; sends a response if this is a valid request. | 535 // Handles the binding request; sends a response if this is a valid request. |
| 534 void HandleBindingRequest(IceMessage* msg); | 536 void HandleBindingRequest(IceMessage* msg); |
| 535 | 537 |
| 536 // Debugging description of this connection | 538 // Debugging description of this connection |
| 537 std::string ToDebugId() const; | 539 std::string ToDebugId() const; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 const rtc::PacketOptions& options) override; | 649 const rtc::PacketOptions& options) override; |
| 648 int GetError() override { return error_; } | 650 int GetError() override { return error_; } |
| 649 | 651 |
| 650 private: | 652 private: |
| 651 int error_ = 0; | 653 int error_ = 0; |
| 652 }; | 654 }; |
| 653 | 655 |
| 654 } // namespace cricket | 656 } // namespace cricket |
| 655 | 657 |
| 656 #endif // WEBRTC_P2P_BASE_PORT_H_ | 658 #endif // WEBRTC_P2P_BASE_PORT_H_ |
| OLD | NEW |