diff options
Diffstat (limited to 'net/quic/quic_connection.h')
| -rw-r--r-- | net/quic/quic_connection.h | 71 |
1 files changed, 28 insertions, 43 deletions
diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h index b9e9ef7..bf4e85c 100644 --- a/net/quic/quic_connection.h +++ b/net/quic/quic_connection.h @@ -54,7 +54,6 @@ class QuicClock; class QuicConfig; class QuicConnection; class QuicEncrypter; -class QuicFecGroup; class QuicRandom; namespace test { @@ -234,11 +233,6 @@ class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor virtual void OnVersionNegotiationPacket( const QuicVersionNegotiationPacket& packet) {} - // Called after a packet has been successfully parsed which results - // in the revival of a packet via FEC. - virtual void OnRevivedPacket(const QuicPacketHeader& revived_header, - base::StringPiece payload) {} - // Called when the connection is closed. virtual void OnConnectionClosed(QuicErrorCode error, ConnectionCloseSource source) {} @@ -307,6 +301,8 @@ class NET_EXPORT_PRIVATE QuicConnection BUNDLE_PENDING_ACK = 2, }; + enum AckMode { TCP_ACKING, ACK_DECIMATION, ACK_DECIMATION_WITH_REORDERING }; + // Constructs a new QuicConnection for |connection_id| and |address| using // |writer| to write packets. |owns_writer| specifies whether the connection // takes ownership of |writer|. |helper| must outlive this connection. @@ -342,10 +338,7 @@ class NET_EXPORT_PRIVATE QuicConnection // Returns a pair with the number of bytes consumed from data, and a boolean // indicating if the fin bit was consumed. This does not indicate the data // has been sent on the wire: it may have been turned into a packet and queued - // if the socket was unexpectedly blocked. |fec_protection| indicates if - // data is to be FEC protected. Note that data that is sent immediately - // following MUST_FEC_PROTECT data may get protected by falling within the - // same FEC group. + // if the socket was unexpectedly blocked. // If |listener| is provided, then it will be informed once ACKs have been // received for all the packets written in this call. // The |listener| is not owned by the QuicConnection and must outlive it. @@ -353,7 +346,6 @@ class NET_EXPORT_PRIVATE QuicConnection QuicIOVector iov, QuicStreamOffset offset, bool fin, - FecProtection fec_protection, QuicAckListenerInterface* listener); // Send a RST_STREAM frame to the peer. @@ -392,8 +384,7 @@ class NET_EXPORT_PRIVATE QuicConnection const QuicConnectionStats& GetStats(); // Processes an incoming UDP packet (consisting of a QuicEncryptedPacket) from - // the peer. If processing this packet permits a packet to be revived from - // its FEC group that packet will be revived and processed. + // the peer. // In a client, the packet may be "stray" and have a different connection ID // than that of this connection. virtual void ProcessUdpPacket(const IPEndPoint& self_address, @@ -412,6 +403,10 @@ class NET_EXPORT_PRIVATE QuicConnection // If the socket is not blocked, writes queued packets. void WriteIfNotBlocked(); + // If the socket is not blocked, writes queued packets and bundles any pending + // ACKs. + void WriteAndBundleAcksIfNotBlocked(); + // Set the packet writer. void SetQuicPacketWriter(QuicPacketWriter* writer, bool owns_writer) { DCHECK(writer != nullptr); @@ -440,13 +435,11 @@ class NET_EXPORT_PRIVATE QuicConnection void OnPublicResetPacket(const QuicPublicResetPacket& packet) override; void OnVersionNegotiationPacket( const QuicVersionNegotiationPacket& packet) override; - void OnRevivedPacket() override; bool OnUnauthenticatedPublicHeader( const QuicPacketPublicHeader& header) override; bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override; void OnDecryptedPacket(EncryptionLevel level) override; bool OnPacketHeader(const QuicPacketHeader& header) override; - void OnFecProtectedPayload(base::StringPiece payload) override; bool OnStreamFrame(const QuicStreamFrame& frame) override; bool OnAckFrame(const QuicAckFrame& frame) override; bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override; @@ -457,7 +450,6 @@ class NET_EXPORT_PRIVATE QuicConnection bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; bool OnBlockedFrame(const QuicBlockedFrame& frame) override; bool OnPathCloseFrame(const QuicPathCloseFrame& frame) override; - void OnFecData(base::StringPiece redundnancy) override; void OnPacketComplete() override; // QuicPacketGenerator::DelegateInterface @@ -470,7 +462,6 @@ class NET_EXPORT_PRIVATE QuicConnection void OnSerializedPacket(SerializedPacket* packet) override; void OnUnrecoverableError(QuicErrorCode error, ConnectionCloseSource source) override; - void OnResetFecGroup() override; // QuicSentPacketManager::NetworkChangeVisitor void OnCongestionWindowChange() override; @@ -516,8 +507,6 @@ class NET_EXPORT_PRIVATE QuicConnection return server_supported_versions_; } - size_t NumFecGroups() const { return group_map_.size(); } - // Testing only. size_t NumQueuedPackets() const { return queued_packets_.size(); } @@ -555,10 +544,6 @@ class NET_EXPORT_PRIVATE QuicConnection // remaining unacked packets. void OnRetransmissionTimeout(); - // Called when a data packet is sent. Starts an alarm if the data sent in - // |packet_number| was FEC protected. - void MaybeSetFecAlarm(QuicPacketNumber packet_number); - // Retransmits all unacked packets with retransmittable frames if // |retransmission_type| is ALL_UNACKED_PACKETS, otherwise retransmits only // initially encrypted packets. Used when the negotiated protocol version is @@ -676,6 +661,8 @@ class NET_EXPORT_PRIVATE QuicConnection QuicConnectionHelperInterface* helper() { return helper_; } + base::StringPiece GetCurrentPacket(); + protected: // Send a packet to the peer, and takes ownership of the packet if the packet // cannot be written immediately. @@ -711,12 +698,18 @@ class NET_EXPORT_PRIVATE QuicConnection per_packet_options_ = options; } + // If |defer| is true, configures the connection to defer sending packets in + // response to an ACK to the SendAlarm. If |defer| is false, packets may be + // sent immediately after receiving an ACK. + void set_defer_send_in_response_to_packets(bool defer) { + defer_send_in_response_to_packets_ = defer; + } + private: friend class test::QuicConnectionPeer; friend class test::PacketSavingConnection; typedef std::list<SerializedPacket> QueuedPacketList; - typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; // Writes the given packet to socket, encrypted with packet's // encryption_level. Returns true on successful write, and false if the writer @@ -767,10 +760,6 @@ class NET_EXPORT_PRIVATE QuicConnection // Attempts to process any queued undecryptable packets. void MaybeProcessUndecryptablePackets(); - // If a packet can be revived from the current FEC group, then - // revive and process the packet. - void MaybeProcessRevivedPacket(); - void ProcessAckFrame(const QuicAckFrame& incoming_ack); void ProcessStopWaitingFrame(const QuicStopWaitingFrame& stop_waiting); @@ -787,13 +776,6 @@ class NET_EXPORT_PRIVATE QuicConnection // to be sent if there are no outstanding packets. QuicPacketNumber GetLeastUnacked() const; - // Get the FEC group associate with the last processed packet or nullptr, if - // the group has already been deleted. - QuicFecGroup* GetFecGroup(); - - // Closes any FEC groups protecting packets before |packet_number|. - void CloseFecGroupsBefore(QuicPacketNumber packet_number); - // Sets the timeout alarm to the appropriate value, if any. void SetTimeoutAlarm(); @@ -865,8 +847,10 @@ class NET_EXPORT_PRIVATE QuicConnection // True if the last packet has gotten far enough in the framer to be // decrypted. bool last_packet_decrypted_; - bool last_packet_revived_; // True if the last packet was revived from FEC. QuicByteCount last_size_; // Size of the last received packet. + // TODO(rch): remove this when b/27221014 is fixed. + const char* current_packet_data_; // UDP payload of packet currently being + // parsed or nullptr. EncryptionLevel last_decrypted_packet_level_; QuicPacketHeader last_header_; QuicStopWaitingFrame last_stop_waiting_frame_; @@ -910,8 +894,6 @@ class NET_EXPORT_PRIVATE QuicConnection // This is particularly important on mobile, where connections are short. bool silent_close_enabled_; - FecGroupMap group_map_; - QuicReceivedPacketManager received_packet_manager_; QuicSentEntropyManager sent_entropy_manager_; @@ -919,13 +901,15 @@ class NET_EXPORT_PRIVATE QuicConnection bool ack_queued_; // How many retransmittable packets have arrived without sending an ack. QuicPacketCount num_retransmittable_packets_received_since_last_ack_sent_; + // Whether there were missing packets in the last sent ack. + bool last_ack_had_missing_packets_; // How many consecutive packets have arrived without sending an ack. QuicPacketCount num_packets_received_since_last_ack_sent_; // Indicates how many consecutive times an ack has arrived which indicates // the peer needs to stop waiting for some packets. int stop_waiting_count_; - // When true, ack only every 10 packets as long as they arrive close together. - bool ack_decimation_enabled_; + // Indicates the current ack mode, defaults to acking every 2 packets. + AckMode ack_mode_; // Indicates the retransmit alarm is going to be set by the // ScopedRetransmitAlarmDelayer @@ -933,6 +917,10 @@ class NET_EXPORT_PRIVATE QuicConnection // Indicates the retransmission alarm needs to be set. bool pending_retransmission_alarm_; + // If true, defer sending data in response to received packets to the + // SendAlarm. + bool defer_send_in_response_to_packets_; + // Arena to store class implementations within the QuicConnection. QuicConnectionArena arena_; @@ -959,9 +947,6 @@ class NET_EXPORT_PRIVATE QuicConnection QuicPacketGenerator packet_generator_; - // An alarm that fires when an FEC packet should be sent. - QuicArenaScopedPtr<QuicAlarm> fec_alarm_; - // Network idle time before this connection is closed. QuicTime::Delta idle_network_timeout_; // The connection will wait this long for the handshake to complete. |
