| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Called when a blocked socket becomes writable. | 96 // Called when a blocked socket becomes writable. |
| 97 virtual void OnCanWrite() = 0; | 97 virtual void OnCanWrite() = 0; |
| 98 | 98 |
| 99 // Called to ask if any writes are pending in this visitor. Writes may be | 99 // Called to ask if any writes are pending in this visitor. Writes may be |
| 100 // pending because they were write-blocked, congestion-throttled or | 100 // pending because they were write-blocked, congestion-throttled or |
| 101 // yielded to other connections. | 101 // yielded to other connections. |
| 102 virtual bool HasPendingWrites() const = 0; | 102 virtual bool HasPendingWrites() const = 0; |
| 103 | 103 |
| 104 // Called to ask if any handshake messages are pending in this visitor. | 104 // Called to ask if any handshake messages are pending in this visitor. |
| 105 virtual bool HasPendingHandshake() const = 0; | 105 virtual bool HasPendingHandshake() const = 0; |
| 106 |
| 107 // Called to ask if any streams are open in this visitor. |
| 108 virtual bool HasOpenStreams() const = 0; |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 // Interface which gets callbacks from the QuicConnection at interesting | 111 // Interface which gets callbacks from the QuicConnection at interesting |
| 109 // points. Implementations must not mutate the state of the connection | 112 // points. Implementations must not mutate the state of the connection |
| 110 // as a result of these callbacks. | 113 // as a result of these callbacks. |
| 111 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitorInterface | 114 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitorInterface |
| 112 : public QuicPacketGenerator::DebugDelegateInterface { | 115 : public QuicPacketGenerator::DebugDelegateInterface { |
| 113 public: | 116 public: |
| 114 virtual ~QuicConnectionDebugVisitorInterface() {} | 117 virtual ~QuicConnectionDebugVisitorInterface() {} |
| 115 | 118 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // Sets (or resets) the total time delta the connection can be alive for. | 387 // Sets (or resets) the total time delta the connection can be alive for. |
| 385 // Also, checks and times out the connection if timer has expired for | 388 // Also, checks and times out the connection if timer has expired for |
| 386 // |timeout|. Used to limit the time a connection can be alive before crypto | 389 // |timeout|. Used to limit the time a connection can be alive before crypto |
| 387 // handshake finishes. | 390 // handshake finishes. |
| 388 void SetOverallConnectionTimeout(QuicTime::Delta timeout); | 391 void SetOverallConnectionTimeout(QuicTime::Delta timeout); |
| 389 | 392 |
| 390 // If the connection has timed out, this will close the connection and return | 393 // If the connection has timed out, this will close the connection and return |
| 391 // true. Otherwise, it will return false and will reset the timeout alarm. | 394 // true. Otherwise, it will return false and will reset the timeout alarm. |
| 392 bool CheckForTimeout(); | 395 bool CheckForTimeout(); |
| 393 | 396 |
| 397 // Sends a ping, and resets the ping alarm. |
| 398 void SendPing(); |
| 399 |
| 394 // Sets up a packet with an QuicAckFrame and sends it out. | 400 // Sets up a packet with an QuicAckFrame and sends it out. |
| 395 void SendAck(); | 401 void SendAck(); |
| 396 | 402 |
| 397 // Called when an RTO fires. Resets the retransmission alarm if there are | 403 // Called when an RTO fires. Resets the retransmission alarm if there are |
| 398 // remaining unacked packets. | 404 // remaining unacked packets. |
| 399 void OnRetransmissionTimeout(); | 405 void OnRetransmissionTimeout(); |
| 400 | 406 |
| 401 // Retransmits all unacked packets with retransmittable frames if | 407 // Retransmits all unacked packets with retransmittable frames if |
| 402 // |retransmission_type| is ALL_PACKETS, otherwise retransmits only initially | 408 // |retransmission_type| is ALL_PACKETS, otherwise retransmits only initially |
| 403 // encrypted packets. Used when the negotiated protocol version is different | 409 // encrypted packets. Used when the negotiated protocol version is different |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // to be sent if there are no outstanding packets. | 589 // to be sent if there are no outstanding packets. |
| 584 QuicPacketSequenceNumber GetLeastUnacked() const; | 590 QuicPacketSequenceNumber GetLeastUnacked() const; |
| 585 | 591 |
| 586 // Get the FEC group associate with the last processed packet or NULL, if the | 592 // Get the FEC group associate with the last processed packet or NULL, if the |
| 587 // group has already been deleted. | 593 // group has already been deleted. |
| 588 QuicFecGroup* GetFecGroup(); | 594 QuicFecGroup* GetFecGroup(); |
| 589 | 595 |
| 590 // Closes any FEC groups protecting packets before |sequence_number|. | 596 // Closes any FEC groups protecting packets before |sequence_number|. |
| 591 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); | 597 void CloseFecGroupsBefore(QuicPacketSequenceNumber sequence_number); |
| 592 | 598 |
| 599 // Sets the ping alarm to the appropriate value, if any. |
| 600 void SetPingAlarm(); |
| 601 |
| 593 QuicFramer framer_; | 602 QuicFramer framer_; |
| 594 QuicConnectionHelperInterface* helper_; // Not owned. | 603 QuicConnectionHelperInterface* helper_; // Not owned. |
| 595 QuicPacketWriter* writer_; // Not owned. | 604 QuicPacketWriter* writer_; // Not owned. |
| 596 EncryptionLevel encryption_level_; | 605 EncryptionLevel encryption_level_; |
| 597 const QuicClock* clock_; | 606 const QuicClock* clock_; |
| 598 QuicRandom* random_generator_; | 607 QuicRandom* random_generator_; |
| 599 | 608 |
| 600 const QuicConnectionId connection_id_; | 609 const QuicConnectionId connection_id_; |
| 601 // Address on the last successfully processed packet received from the | 610 // Address on the last successfully processed packet received from the |
| 602 // client. | 611 // client. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 // An alarm that fires when a packet needs to be retransmitted. | 671 // An alarm that fires when a packet needs to be retransmitted. |
| 663 scoped_ptr<QuicAlarm> retransmission_alarm_; | 672 scoped_ptr<QuicAlarm> retransmission_alarm_; |
| 664 // An alarm that is scheduled when the sent scheduler requires a | 673 // An alarm that is scheduled when the sent scheduler requires a |
| 665 // a delay before sending packets and fires when the packet may be sent. | 674 // a delay before sending packets and fires when the packet may be sent. |
| 666 scoped_ptr<QuicAlarm> send_alarm_; | 675 scoped_ptr<QuicAlarm> send_alarm_; |
| 667 // An alarm that is scheduled when the connection can still write and there | 676 // An alarm that is scheduled when the connection can still write and there |
| 668 // may be more data to send. | 677 // may be more data to send. |
| 669 scoped_ptr<QuicAlarm> resume_writes_alarm_; | 678 scoped_ptr<QuicAlarm> resume_writes_alarm_; |
| 670 // An alarm that fires when the connection may have timed out. | 679 // An alarm that fires when the connection may have timed out. |
| 671 scoped_ptr<QuicAlarm> timeout_alarm_; | 680 scoped_ptr<QuicAlarm> timeout_alarm_; |
| 681 // An alarm that fires when a ping should be sent. |
| 682 scoped_ptr<QuicAlarm> ping_alarm_; |
| 672 | 683 |
| 673 QuicConnectionVisitorInterface* visitor_; | 684 QuicConnectionVisitorInterface* visitor_; |
| 674 QuicConnectionDebugVisitorInterface* debug_visitor_; | 685 QuicConnectionDebugVisitorInterface* debug_visitor_; |
| 675 QuicPacketCreator packet_creator_; | 686 QuicPacketCreator packet_creator_; |
| 676 QuicPacketGenerator packet_generator_; | 687 QuicPacketGenerator packet_generator_; |
| 677 | 688 |
| 678 // Network idle time before we kill of this connection. | 689 // Network idle time before we kill of this connection. |
| 679 QuicTime::Delta idle_network_timeout_; | 690 QuicTime::Delta idle_network_timeout_; |
| 680 // Overall connection timeout. | 691 // Overall connection timeout. |
| 681 QuicTime::Delta overall_connection_timeout_; | 692 QuicTime::Delta overall_connection_timeout_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 733 |
| 723 // Initial flow control receive window size for new streams. | 734 // Initial flow control receive window size for new streams. |
| 724 uint32 max_flow_control_receive_window_bytes_; | 735 uint32 max_flow_control_receive_window_bytes_; |
| 725 | 736 |
| 726 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 737 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 727 }; | 738 }; |
| 728 | 739 |
| 729 } // namespace net | 740 } // namespace net |
| 730 | 741 |
| 731 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 742 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |