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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 bool weak() const { return !(writable() && receiving() && connected()); } | 455 bool weak() const { return !(writable() && receiving() && connected()); } |
456 bool active() const { | 456 bool active() const { |
457 return write_state_ != STATE_WRITE_TIMEOUT; | 457 return write_state_ != STATE_WRITE_TIMEOUT; |
458 } | 458 } |
459 // A connection is dead if it can be safely deleted. | 459 // A connection is dead if it can be safely deleted. |
460 bool dead(int64_t now) const; | 460 bool dead(int64_t now) const; |
461 | 461 |
462 // Estimate of the round-trip time over this connection. | 462 // Estimate of the round-trip time over this connection. |
463 int rtt() const { return rtt_; } | 463 int rtt() const { return rtt_; } |
464 | 464 |
465 size_t sent_total_bytes(); | 465 ConnectionInfo stats(); |
466 size_t sent_bytes_second(); | 466 |
467 // Used to track how many packets are discarded in the application socket due | |
468 // to errors. | |
469 size_t sent_discarded_packets(); | |
470 size_t sent_total_packets(); | |
471 size_t recv_total_bytes(); | |
472 size_t recv_bytes_second(); | |
473 sigslot::signal1<Connection*> SignalStateChange; | 467 sigslot::signal1<Connection*> SignalStateChange; |
474 | 468 |
475 // Sent when the connection has decided that it is no longer of value. It | 469 // Sent when the connection has decided that it is no longer of value. It |
476 // will delete itself immediately after this call. | 470 // will delete itself immediately after this call. |
477 sigslot::signal1<Connection*> SignalDestroyed; | 471 sigslot::signal1<Connection*> SignalDestroyed; |
478 | 472 |
479 // The connection can send and receive packets asynchronously. This matches | 473 // The connection can send and receive packets asynchronously. This matches |
480 // the interface of AsyncPacketSocket, which may use UDP or TCP under the | 474 // the interface of AsyncPacketSocket, which may use UDP or TCP under the |
481 // covers. | 475 // covers. |
482 virtual int Send(const void* data, size_t size, | 476 virtual int Send(const void* data, size_t size, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 int rtt_; | 625 int rtt_; |
632 int64_t last_ping_sent_; // last time we sent a ping to the other side | 626 int64_t last_ping_sent_; // last time we sent a ping to the other side |
633 int64_t last_ping_received_; // last time we received a ping from the other | 627 int64_t last_ping_received_; // last time we received a ping from the other |
634 // side | 628 // side |
635 int64_t last_data_received_; | 629 int64_t last_data_received_; |
636 int64_t last_ping_response_received_; | 630 int64_t last_ping_response_received_; |
637 std::vector<SentPing> pings_since_last_response_; | 631 std::vector<SentPing> pings_since_last_response_; |
638 | 632 |
639 rtc::RateTracker recv_rate_tracker_; | 633 rtc::RateTracker recv_rate_tracker_; |
640 rtc::RateTracker send_rate_tracker_; | 634 rtc::RateTracker send_rate_tracker_; |
641 uint32_t sent_packets_discarded_; | 635 |
642 uint32_t sent_packets_total_; | 636 ConnectionInfo stats_; |
643 | 637 |
644 private: | 638 private: |
645 void MaybeAddPrflxCandidate(ConnectionRequest* request, | 639 void MaybeAddPrflxCandidate(ConnectionRequest* request, |
646 StunMessage* response); | 640 StunMessage* response); |
647 | 641 |
648 bool reported_; | 642 bool reported_; |
649 State state_; | 643 State state_; |
650 // Time duration to switch from receiving to not receiving. | 644 // Time duration to switch from receiving to not receiving. |
651 int receiving_timeout_; | 645 int receiving_timeout_; |
652 int64_t time_created_ms_; | 646 int64_t time_created_ms_; |
(...skipping 13 matching lines...) Expand all Loading... |
666 const rtc::PacketOptions& options) override; | 660 const rtc::PacketOptions& options) override; |
667 int GetError() override { return error_; } | 661 int GetError() override { return error_; } |
668 | 662 |
669 private: | 663 private: |
670 int error_ = 0; | 664 int error_ = 0; |
671 }; | 665 }; |
672 | 666 |
673 } // namespace cricket | 667 } // namespace cricket |
674 | 668 |
675 #endif // WEBRTC_P2P_BASE_PORT_H_ | 669 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |