| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
| 6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
| 7 // | 7 // |
| 8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
| 9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
| 10 // | 10 // |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 size_t NumFecGroups() const { return group_map_.size(); } | 331 size_t NumFecGroups() const { return group_map_.size(); } |
| 332 | 332 |
| 333 // Testing only. | 333 // Testing only. |
| 334 size_t NumQueuedPackets() const { return queued_packets_.size(); } | 334 size_t NumQueuedPackets() const { return queued_packets_.size(); } |
| 335 | 335 |
| 336 // Returns true if the connection has queued packets or frames. | 336 // Returns true if the connection has queued packets or frames. |
| 337 bool HasQueuedData() const; | 337 bool HasQueuedData() const; |
| 338 | 338 |
| 339 // Sets (or resets) the idle state connection timeout. Also, checks and times | 339 // Sets (or resets) the idle state connection timeout. Also, checks and times |
| 340 // out the connection if network timer has expired for |timeout|. | 340 // out the connection if network timer has expired for |timeout|. |
| 341 void SetConnectionTimeout(QuicTime::Delta timeout); | 341 void SetIdleNetworkTimeout(QuicTime::Delta timeout); |
| 342 // Sets (or resets) the total time delta the connection can be alive for. |
| 343 // Also, checks and times out the connection if timer has expired for |
| 344 // |timeout|. Used to limit the time a connection can be alive before crypto |
| 345 // handshake finishes. |
| 346 void SetOverallConnectionTimeout(QuicTime::Delta timeout); |
| 342 | 347 |
| 343 // If the connection has timed out, this will close the connection and return | 348 // If the connection has timed out, this will close the connection and return |
| 344 // true. Otherwise, it will return false and will reset the timeout alarm. | 349 // true. Otherwise, it will return false and will reset the timeout alarm. |
| 345 bool CheckForTimeout(); | 350 bool CheckForTimeout(); |
| 346 | 351 |
| 347 // Returns true of the next packet to be sent should be "lost" by | 352 // Returns true of the next packet to be sent should be "lost" by |
| 348 // not actually writing it to the wire. | 353 // not actually writing it to the wire. |
| 349 bool ShouldSimulateLostPacket(); | 354 bool ShouldSimulateLostPacket(); |
| 350 | 355 |
| 351 // Sets up a packet with an QuicAckFrame and sends it out. | 356 // Sets up a packet with an QuicAckFrame and sends it out. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 FecGroupMap group_map_; | 598 FecGroupMap group_map_; |
| 594 | 599 |
| 595 QuicPacketEntropyManager entropy_manager_; | 600 QuicPacketEntropyManager entropy_manager_; |
| 596 | 601 |
| 597 QuicConnectionVisitorInterface* visitor_; | 602 QuicConnectionVisitorInterface* visitor_; |
| 598 QuicConnectionDebugVisitorInterface* debug_visitor_; | 603 QuicConnectionDebugVisitorInterface* debug_visitor_; |
| 599 QuicPacketCreator packet_creator_; | 604 QuicPacketCreator packet_creator_; |
| 600 QuicPacketGenerator packet_generator_; | 605 QuicPacketGenerator packet_generator_; |
| 601 | 606 |
| 602 // Network idle time before we kill of this connection. | 607 // Network idle time before we kill of this connection. |
| 603 QuicTime::Delta timeout_; | 608 QuicTime::Delta idle_network_timeout_; |
| 609 // Overall connection timeout. |
| 610 QuicTime::Delta overall_connection_timeout_; |
| 611 // Connection creation time. |
| 612 QuicTime creation_time_; |
| 604 | 613 |
| 605 // Statistics for this session. | 614 // Statistics for this session. |
| 606 QuicConnectionStats stats_; | 615 QuicConnectionStats stats_; |
| 607 | 616 |
| 608 // The time that we got a packet for this connection. | 617 // The time that we got a packet for this connection. |
| 609 QuicTime time_of_last_received_packet_; | 618 QuicTime time_of_last_received_packet_; |
| 610 | 619 |
| 611 // The time that we last sent a packet for this connection. | 620 // The time that we last sent a packet for this connection. |
| 612 QuicTime time_of_last_sent_packet_; | 621 QuicTime time_of_last_sent_packet_; |
| 613 | 622 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 630 // Tracks if the connection was created by the server. | 639 // Tracks if the connection was created by the server. |
| 631 bool is_server_; | 640 bool is_server_; |
| 632 | 641 |
| 633 // True by default. False if we've received or sent an explicit connection | 642 // True by default. False if we've received or sent an explicit connection |
| 634 // close. | 643 // close. |
| 635 bool connected_; | 644 bool connected_; |
| 636 | 645 |
| 637 // True if the last ack received from the peer may have been truncated. False | 646 // True if the last ack received from the peer may have been truncated. False |
| 638 // otherwise. | 647 // otherwise. |
| 639 bool received_truncated_ack_; | 648 bool received_truncated_ack_; |
| 640 | |
| 641 bool send_ack_in_response_to_packet_; | 649 bool send_ack_in_response_to_packet_; |
| 642 | 650 |
| 643 // Set to true if the udp packet headers have a new self or peer address. | 651 // Set to true if the udp packet headers have a new self or peer address. |
| 644 // This is checked later on validating a data or version negotiation packet. | 652 // This is checked later on validating a data or version negotiation packet. |
| 645 bool address_migrating_; | 653 bool address_migrating_; |
| 646 | 654 |
| 647 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 655 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 648 }; | 656 }; |
| 649 | 657 |
| 650 } // namespace net | 658 } // namespace net |
| 651 | 659 |
| 652 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 660 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |