| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // handshake finishes. | 352 // handshake finishes. |
| 353 void SetOverallConnectionTimeout(QuicTime::Delta timeout); | 353 void SetOverallConnectionTimeout(QuicTime::Delta timeout); |
| 354 | 354 |
| 355 // If the connection has timed out, this will close the connection and return | 355 // If the connection has timed out, this will close the connection and return |
| 356 // true. Otherwise, it will return false and will reset the timeout alarm. | 356 // true. Otherwise, it will return false and will reset the timeout alarm. |
| 357 bool CheckForTimeout(); | 357 bool CheckForTimeout(); |
| 358 | 358 |
| 359 // Sets up a packet with an QuicAckFrame and sends it out. | 359 // Sets up a packet with an QuicAckFrame and sends it out. |
| 360 void SendAck(); | 360 void SendAck(); |
| 361 | 361 |
| 362 // Called when an RTO fires. Returns the time when this alarm | 362 // Called when an RTO fires. Resets the retransmission alarm if there are |
| 363 // should next fire, or 0 if no retransmission alarm should be set. | 363 // remaining unacked packets. |
| 364 void OnRetransmissionTimeout(); | 364 void OnRetransmissionTimeout(); |
| 365 | 365 |
| 366 // Called when an alarm to abandon sent FEC packets fires. The alarm is set | |
| 367 // by the same policy as the RTO alarm, but is a separate alarm. | |
| 368 QuicTime OnAbandonFecTimeout(); | |
| 369 | |
| 370 // Retransmits all unacked packets with retransmittable frames if | 366 // Retransmits all unacked packets with retransmittable frames if |
| 371 // |retransmission_type| is ALL_PACKETS, otherwise retransmits only initially | 367 // |retransmission_type| is ALL_PACKETS, otherwise retransmits only initially |
| 372 // encrypted packets. Used when the negotiated protocol version is different | 368 // encrypted packets. Used when the negotiated protocol version is different |
| 373 // from what was initially assumed and when the visitor wants to re-transmit | 369 // from what was initially assumed and when the visitor wants to re-transmit |
| 374 // initially encrypted packets when the initial encrypter changes. | 370 // initially encrypted packets when the initial encrypter changes. |
| 375 void RetransmitUnackedPackets(RetransmissionType retransmission_type); | 371 void RetransmitUnackedPackets(RetransmissionType retransmission_type); |
| 376 | 372 |
| 377 // Changes the encrypter used for level |level| to |encrypter|. The function | 373 // Changes the encrypter used for level |level| to |encrypter|. The function |
| 378 // takes ownership of |encrypter|. | 374 // takes ownership of |encrypter|. |
| 379 void SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter); | 375 void SetEncrypter(EncryptionLevel level, QuicEncrypter* encrypter); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 typedef std::list<QueuedPacket> QueuedPacketList; | 568 typedef std::list<QueuedPacket> QueuedPacketList; |
| 573 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; | 569 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; |
| 574 typedef std::priority_queue<RetransmissionTime, | 570 typedef std::priority_queue<RetransmissionTime, |
| 575 std::vector<RetransmissionTime>, | 571 std::vector<RetransmissionTime>, |
| 576 RetransmissionTimeComparator> | 572 RetransmissionTimeComparator> |
| 577 RetransmissionTimeouts; | 573 RetransmissionTimeouts; |
| 578 | 574 |
| 579 // Sends a version negotiation packet to the peer. | 575 // Sends a version negotiation packet to the peer. |
| 580 void SendVersionNegotiationPacket(); | 576 void SendVersionNegotiationPacket(); |
| 581 | 577 |
| 582 void SetupRetransmission(QuicPacketSequenceNumber sequence_number, | 578 void SetupRetransmissionAlarm(QuicPacketSequenceNumber sequence_number); |
| 583 EncryptionLevel level); | |
| 584 bool IsRetransmission(QuicPacketSequenceNumber sequence_number); | 579 bool IsRetransmission(QuicPacketSequenceNumber sequence_number); |
| 585 | 580 |
| 586 void SetupAbandonFecTimer(QuicPacketSequenceNumber sequence_number); | 581 void SetupAbandonFecTimer(QuicPacketSequenceNumber sequence_number); |
| 587 | 582 |
| 588 // Clears any accumulated frames from the last received packet. | 583 // Clears any accumulated frames from the last received packet. |
| 589 void ClearLastFrames(); | 584 void ClearLastFrames(); |
| 590 | 585 |
| 591 // Called from OnCanWrite and WriteIfNotBlocked to write queued packets. | 586 // Called from OnCanWrite and WriteIfNotBlocked to write queued packets. |
| 592 // Returns false if the socket has become blocked. | 587 // Returns false if the socket has become blocked. |
| 593 bool DoWrite(); | 588 bool DoWrite(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 696 |
| 702 FecGroupMap group_map_; | 697 FecGroupMap group_map_; |
| 703 | 698 |
| 704 QuicReceivedPacketManager received_packet_manager_; | 699 QuicReceivedPacketManager received_packet_manager_; |
| 705 QuicSentEntropyManager sent_entropy_manager_; | 700 QuicSentEntropyManager sent_entropy_manager_; |
| 706 | 701 |
| 707 // An alarm that fires when an ACK should be sent to the peer. | 702 // An alarm that fires when an ACK should be sent to the peer. |
| 708 scoped_ptr<QuicAlarm> ack_alarm_; | 703 scoped_ptr<QuicAlarm> ack_alarm_; |
| 709 // An alarm that fires when a packet needs to be retransmitted. | 704 // An alarm that fires when a packet needs to be retransmitted. |
| 710 scoped_ptr<QuicAlarm> retransmission_alarm_; | 705 scoped_ptr<QuicAlarm> retransmission_alarm_; |
| 711 // An alarm that fires when one or more FEC packets are to be discarded. | |
| 712 scoped_ptr<QuicAlarm> abandon_fec_alarm_; | |
| 713 // An alarm that is scheduled when the sent scheduler requires a | 706 // An alarm that is scheduled when the sent scheduler requires a |
| 714 // a delay before sending packets and fires when the packet may be sent. | 707 // a delay before sending packets and fires when the packet may be sent. |
| 715 scoped_ptr<QuicAlarm> send_alarm_; | 708 scoped_ptr<QuicAlarm> send_alarm_; |
| 716 // An alarm that is scheduled when the connection can still write and there | 709 // An alarm that is scheduled when the connection can still write and there |
| 717 // may be more data to send. | 710 // may be more data to send. |
| 718 scoped_ptr<QuicAlarm> resume_writes_alarm_; | 711 scoped_ptr<QuicAlarm> resume_writes_alarm_; |
| 719 // An alarm that fires when the connection may have timed out. | 712 // An alarm that fires when the connection may have timed out. |
| 720 scoped_ptr<QuicAlarm> timeout_alarm_; | 713 scoped_ptr<QuicAlarm> timeout_alarm_; |
| 721 | 714 |
| 722 QuicConnectionVisitorInterface* visitor_; | 715 QuicConnectionVisitorInterface* visitor_; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // If non-empty this contains the set of versions received in a | 766 // If non-empty this contains the set of versions received in a |
| 774 // version negotiation packet. | 767 // version negotiation packet. |
| 775 QuicVersionVector server_supported_versions_; | 768 QuicVersionVector server_supported_versions_; |
| 776 | 769 |
| 777 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 770 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 778 }; | 771 }; |
| 779 | 772 |
| 780 } // namespace net | 773 } // namespace net |
| 781 | 774 |
| 782 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 775 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |