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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 void Destroy(); | 514 void Destroy(); |
516 | 515 |
517 // Checks that the state of this connection is up-to-date. The argument is | 516 // Checks that the state of this connection is up-to-date. The argument is |
518 // the current time, which is compared against various timeouts. | 517 // the current time, which is compared against various timeouts. |
519 void UpdateState(uint32_t now); | 518 void UpdateState(uint32_t now); |
520 | 519 |
521 // Called when this connection should try checking writability again. | 520 // Called when this connection should try checking writability again. |
522 uint32_t last_ping_sent() const { return last_ping_sent_; } | 521 uint32_t last_ping_sent() const { return last_ping_sent_; } |
523 void Ping(uint32_t now); | 522 void Ping(uint32_t now); |
524 void ReceivedPingResponse(); | 523 void ReceivedPingResponse(); |
| 524 uint32_t last_ping_response_received() const { |
| 525 return last_ping_response_received_; |
| 526 } |
525 | 527 |
526 // Called whenever a valid ping is received on this connection. This is | 528 // Called whenever a valid ping is received on this connection. This is |
527 // public because the connection intercepts the first ping for us. | 529 // public because the connection intercepts the first ping for us. |
528 uint32_t last_ping_received() const { return last_ping_received_; } | 530 uint32_t last_ping_received() const { return last_ping_received_; } |
529 void ReceivedPing(); | 531 void ReceivedPing(); |
530 // Handles the binding request; sends a response if this is a valid request. | 532 // Handles the binding request; sends a response if this is a valid request. |
531 void HandleBindingRequest(IceMessage* msg); | 533 void HandleBindingRequest(IceMessage* msg); |
532 | 534 |
533 // Debugging description of this connection | 535 // Debugging description of this connection |
534 std::string ToDebugId() const; | 536 std::string ToDebugId() const; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 const rtc::PacketOptions& options); | 645 const rtc::PacketOptions& options); |
644 virtual int GetError() { return error_; } | 646 virtual int GetError() { return error_; } |
645 | 647 |
646 private: | 648 private: |
647 int error_; | 649 int error_; |
648 }; | 650 }; |
649 | 651 |
650 } // namespace cricket | 652 } // namespace cricket |
651 | 653 |
652 #endif // WEBRTC_P2P_BASE_PORT_H_ | 654 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |