Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: net/quic/quic_connection.h

Issue 23691073: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiler/unittests fix Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/congestion_control/send_algorithm_interface.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 #include "net/quic/quic_ack_notifier.h" 31 #include "net/quic/quic_ack_notifier.h"
32 #include "net/quic/quic_alarm.h" 32 #include "net/quic/quic_alarm.h"
33 #include "net/quic/quic_blocked_writer_interface.h" 33 #include "net/quic/quic_blocked_writer_interface.h"
34 #include "net/quic/quic_connection_stats.h" 34 #include "net/quic/quic_connection_stats.h"
35 #include "net/quic/quic_framer.h" 35 #include "net/quic/quic_framer.h"
36 #include "net/quic/quic_packet_creator.h" 36 #include "net/quic/quic_packet_creator.h"
37 #include "net/quic/quic_packet_generator.h" 37 #include "net/quic/quic_packet_generator.h"
38 #include "net/quic/quic_protocol.h" 38 #include "net/quic/quic_protocol.h"
39 #include "net/quic/quic_received_packet_manager.h" 39 #include "net/quic/quic_received_packet_manager.h"
40 #include "net/quic/quic_sent_entropy_manager.h" 40 #include "net/quic/quic_sent_entropy_manager.h"
41 #include "net/quic/quic_sent_packet_manager.h"
41 42
42 namespace net { 43 namespace net {
43 44
44 class QuicClock; 45 class QuicClock;
45 class QuicConnection; 46 class QuicConnection;
46 class QuicFecGroup; 47 class QuicFecGroup;
47 class QuicRandom; 48 class QuicRandom;
48 49
49 namespace test { 50 namespace test {
50 class QuicConnectionPeer; 51 class QuicConnectionPeer;
51 } // namespace test 52 } // namespace test
52 53
54 // Class that receives callbacks from the connection when frames are received
55 // and when other interesting events happen.
53 class NET_EXPORT_PRIVATE QuicConnectionVisitorInterface { 56 class NET_EXPORT_PRIVATE QuicConnectionVisitorInterface {
54 public: 57 public:
55 virtual ~QuicConnectionVisitorInterface() {} 58 virtual ~QuicConnectionVisitorInterface() {}
56 59
57 // A simple visitor interface for dealing with data frames. The session 60 // A simple visitor interface for dealing with data frames. The session
58 // should determine if all frames will be accepted, and return true if so. 61 // should determine if all frames will be accepted, and return true if so.
59 // If any frames can't be processed or buffered, none of the data should 62 // If any frames can't be processed or buffered, none of the data should
60 // be used, and the callee should return false. 63 // be used, and the callee should return false.
61 virtual bool OnPacket(const IPEndPoint& self_address, 64 virtual bool OnStreamFrames(const std::vector<QuicStreamFrame>& frames) = 0;
62 const IPEndPoint& peer_address,
63 const QuicPacketHeader& header,
64 const std::vector<QuicStreamFrame>& frame) = 0;
65 65
66 // Called when the stream is reset by the peer. 66 // Called when the stream is reset by the peer.
67 virtual void OnRstStream(const QuicRstStreamFrame& frame) = 0; 67 virtual void OnRstStream(const QuicRstStreamFrame& frame) = 0;
68 68
69 // Called when the connection is going away according to the peer. 69 // Called when the connection is going away according to the peer.
70 virtual void OnGoAway(const QuicGoAwayFrame& frame) = 0; 70 virtual void OnGoAway(const QuicGoAwayFrame& frame) = 0;
71 71
72 // Called when the connection is closed either locally by the framer, or 72 // Called when the connection is closed either locally by the framer, or
73 // remotely by the peer. 73 // remotely by the peer.
74 virtual void ConnectionClose(QuicErrorCode error, 74 virtual void ConnectionClose(QuicErrorCode error,
75 bool from_peer) = 0; 75 bool from_peer) = 0;
76 76
77 // Called when packets are acked by the peer.
78 virtual void OnAck(const SequenceNumberSet& acked_packets) = 0;
79
80 // Called once a specific QUIC version is agreed by both endpoints. 77 // Called once a specific QUIC version is agreed by both endpoints.
81 virtual void OnSuccessfulVersionNegotiation(const QuicVersion& version) = 0; 78 virtual void OnSuccessfulVersionNegotiation(const QuicVersion& version) = 0;
82 79
83 // Called when a blocked socket becomes writable. If all pending bytes for 80 // Called when a blocked socket becomes writable. If all pending bytes for
84 // this visitor are consumed by the connection successfully this should 81 // this visitor are consumed by the connection successfully this should
85 // return true, otherwise it should return false. 82 // return true, otherwise it should return false.
86 virtual bool OnCanWrite() = 0; 83 virtual bool OnCanWrite() = 0;
84
85 // Called to ask if any handshake messages are pending in this visitor.
86 virtual bool HasPendingHandshake() const = 0;
87 }; 87 };
88 88
89 // Interface which gets callbacks from the QuicConnection at interesting 89 // Interface which gets callbacks from the QuicConnection at interesting
90 // points. Implementations must not mutate the state of the connection 90 // points. Implementations must not mutate the state of the connection
91 // as a result of these callbacks. 91 // as a result of these callbacks.
92 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitorInterface 92 class NET_EXPORT_PRIVATE QuicConnectionDebugVisitorInterface
93 : public QuicPacketGenerator::DebugDelegateInterface { 93 : public QuicPacketGenerator::DebugDelegateInterface {
94 public: 94 public:
95 virtual ~QuicConnectionDebugVisitorInterface() {} 95 virtual ~QuicConnectionDebugVisitorInterface() {}
96 96
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 // Creates a new platform-specific alarm which will be configured to 182 // Creates a new platform-specific alarm which will be configured to
183 // notify |delegate| when the alarm fires. Caller takes ownership 183 // notify |delegate| when the alarm fires. Caller takes ownership
184 // of the new alarm, which will not yet be "set" to fire. 184 // of the new alarm, which will not yet be "set" to fire.
185 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0; 185 virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) = 0;
186 }; 186 };
187 187
188 class NET_EXPORT_PRIVATE QuicConnection 188 class NET_EXPORT_PRIVATE QuicConnection
189 : public QuicFramerVisitorInterface, 189 : public QuicFramerVisitorInterface,
190 public QuicBlockedWriterInterface, 190 public QuicBlockedWriterInterface,
191 public QuicPacketGenerator::DelegateInterface { 191 public QuicPacketGenerator::DelegateInterface,
192 public QuicSentPacketManager::HelperInterface {
192 public: 193 public:
193 enum Force { 194 enum Force {
194 NO_FORCE, 195 NO_FORCE,
195 FORCE 196 FORCE
196 }; 197 };
197 198
198 enum RetransmissionType { 199 enum RetransmissionType {
199 INITIAL_ENCRYPTION_ONLY, 200 INITIAL_ENCRYPTION_ONLY,
200 ALL_PACKETS 201 ALL_PACKETS
201 }; 202 };
202 203
203 // Constructs a new QuicConnection for the specified |guid| and |address|. 204 // Constructs a new QuicConnection for the specified |guid| and |address|.
204 // |helper| will be owned by this connection. 205 // |helper| will be owned by this connection.
205 QuicConnection(QuicGuid guid, 206 QuicConnection(QuicGuid guid,
206 IPEndPoint address, 207 IPEndPoint address,
207 QuicConnectionHelperInterface* helper, 208 QuicConnectionHelperInterface* helper,
208 bool is_server, 209 bool is_server,
209 QuicVersion version); 210 QuicVersion version);
210 virtual ~QuicConnection(); 211 virtual ~QuicConnection();
211 212
212 // Send the data in |iov| to the peer in as few packets as possible. 213 // Send the data in |iov| to the peer in as few packets as possible.
213 // Returns a pair with the number of bytes consumed from data, and a boolean 214 // Returns a pair with the number of bytes consumed from data, and a boolean
214 // indicating if the fin bit was consumed. This does not indicate the data 215 // indicating if the fin bit was consumed. This does not indicate the data
215 // has been sent on the wire: it may have been turned into a packet and queued 216 // has been sent on the wire: it may have been turned into a packet and queued
216 // if the socket was unexpectedly blocked. 217 // if the socket was unexpectedly blocked.
217 QuicConsumedData SendvStreamData(QuicStreamId id, 218 QuicConsumedData SendvStreamData(QuicStreamId id,
218 const struct iovec* iov, 219 const struct iovec* iov,
219 int count, 220 int iov_count,
220 QuicStreamOffset offset, 221 QuicStreamOffset offset,
221 bool fin); 222 bool fin);
222 223
223 // Same as above, except that the provided delegate will be informed once ACKs 224 // Same as SendvStreamData, except the provided delegate will be informed
224 // have been received for all the packets written. 225 // once ACKs have been received for all the packets written.
225 // The |delegate| is not owned by the QuicConnection and must outlive it. 226 // The |delegate| is not owned by the QuicConnection and must outlive it.
226 QuicConsumedData SendStreamDataAndNotifyWhenAcked( 227 QuicConsumedData SendvStreamDataAndNotifyWhenAcked(
227 QuicStreamId id, 228 QuicStreamId id,
228 base::StringPiece data, 229 const struct iovec* iov,
230 int iov_count,
229 QuicStreamOffset offset, 231 QuicStreamOffset offset,
230 bool fin, 232 bool fin,
231 QuicAckNotifier::DelegateInterface* delegate); 233 QuicAckNotifier::DelegateInterface* delegate);
232 234
233 // Send a stream reset frame to the peer. 235 // Send a stream reset frame to the peer.
234 virtual void SendRstStream(QuicStreamId id, 236 virtual void SendRstStream(QuicStreamId id,
235 QuicRstStreamErrorCode error); 237 QuicRstStreamErrorCode error);
236 238
237 // Sends the connection close packet without affecting the state of the 239 // Sends the connection close packet without affecting the state of the
238 // connection. This should only be called if the session is actively being 240 // connection. This should only be called if the session is actively being
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 304
303 // QuicPacketGenerator::DelegateInterface 305 // QuicPacketGenerator::DelegateInterface
304 virtual bool CanWrite( 306 virtual bool CanWrite(
305 Retransmission is_retransmission, 307 Retransmission is_retransmission,
306 HasRetransmittableData has_retransmittable_data, 308 HasRetransmittableData has_retransmittable_data,
307 IsHandshake handshake) OVERRIDE; 309 IsHandshake handshake) OVERRIDE;
308 virtual QuicAckFrame* CreateAckFrame() OVERRIDE; 310 virtual QuicAckFrame* CreateAckFrame() OVERRIDE;
309 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; 311 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE;
310 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; 312 virtual bool OnSerializedPacket(const SerializedPacket& packet) OVERRIDE;
311 313
314 // QuicSentPacketManager::HelperInterface
315 virtual QuicPacketSequenceNumber GetPeerLargestObservedPacket() OVERRIDE;
316 virtual QuicPacketSequenceNumber GetNextPacketSequenceNumber() OVERRIDE;
317 virtual void OnPacketNacked(QuicPacketSequenceNumber sequence_number,
318 size_t nack_count) OVERRIDE;
319
312 // Accessors 320 // Accessors
313 void set_visitor(QuicConnectionVisitorInterface* visitor) { 321 void set_visitor(QuicConnectionVisitorInterface* visitor) {
314 visitor_ = visitor; 322 visitor_ = visitor;
315 } 323 }
316 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) { 324 void set_debug_visitor(QuicConnectionDebugVisitorInterface* debug_visitor) {
317 debug_visitor_ = debug_visitor; 325 debug_visitor_ = debug_visitor;
318 packet_generator_.set_debug_delegate(debug_visitor); 326 packet_generator_.set_debug_delegate(debug_visitor);
319 } 327 }
320 const IPEndPoint& self_address() const { return self_address_; } 328 const IPEndPoint& self_address() const { return self_address_; }
321 const IPEndPoint& peer_address() const { return peer_address_; } 329 const IPEndPoint& peer_address() const { return peer_address_; }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 416
409 bool is_server() const { return is_server_; } 417 bool is_server() const { return is_server_; }
410 418
411 static bool g_acks_do_not_instigate_acks; 419 static bool g_acks_do_not_instigate_acks;
412 420
413 protected: 421 protected:
414 // Send a packet to the peer using encryption |level|. If |sequence_number| 422 // Send a packet to the peer using encryption |level|. If |sequence_number|
415 // is present in the |retransmission_map_|, then contents of this packet will 423 // is present in the |retransmission_map_|, then contents of this packet will
416 // be retransmitted with a new sequence number if it's not acked by the peer. 424 // be retransmitted with a new sequence number if it's not acked by the peer.
417 // Deletes |packet| via WritePacket call or transfers ownership to 425 // Deletes |packet| via WritePacket call or transfers ownership to
418 // QueuedPacket, ultimately deleted via WritePacket. Also, it updates the 426 // QueuedPacket, ultimately deleted via WritePacket. Updates the
419 // entropy map corresponding to |sequence_number| using |entropy_hash|. 427 // entropy map corresponding to |sequence_number| using |entropy_hash|.
428 // |retransmittable| is supplied to the congestion manager, and when |forced|
429 // is true, it bypasses the congestion manager.
420 // TODO(wtc): none of the callers check the return value. 430 // TODO(wtc): none of the callers check the return value.
421 virtual bool SendOrQueuePacket(EncryptionLevel level, 431 virtual bool SendOrQueuePacket(EncryptionLevel level,
422 QuicPacketSequenceNumber sequence_number, 432 QuicPacketSequenceNumber sequence_number,
423 QuicPacket* packet, 433 QuicPacket* packet,
424 QuicPacketEntropyHash entropy_hash, 434 QuicPacketEntropyHash entropy_hash,
425 HasRetransmittableData retransmittable); 435 HasRetransmittableData retransmittable,
436 Force forced);
426 437
427 // Writes the given packet to socket, encrypted with |level|, with the help 438 // Writes the given packet to socket, encrypted with |level|, with the help
428 // of helper. Returns true on successful write, false otherwise. However, 439 // of helper. Returns true on successful write, false otherwise. However,
429 // behavior is undefined if connection is not established or broken. In any 440 // behavior is undefined if connection is not established or broken. In any
430 // circumstances, a return value of true implies that |packet| has been 441 // circumstances, a return value of true implies that |packet| has been
431 // deleted and should not be accessed. If |sequence_number| is present in 442 // deleted and should not be accessed. If |sequence_number| is present in
432 // |retransmission_map_| it also sets up retransmission of the given packet 443 // |retransmission_map_| it also sets up retransmission of the given packet
433 // in case of successful write. If |force| is FORCE, then the packet will be 444 // in case of successful write. If |force| is FORCE, then the packet will be
434 // sent immediately and the send scheduler will not be consulted. 445 // sent immediately and the send scheduler will not be consulted.
435 bool WritePacket(EncryptionLevel level, 446 bool WritePacket(EncryptionLevel level,
(...skipping 15 matching lines...) Expand all
451 // Selects and updates the version of the protocol being used by selecting a 462 // Selects and updates the version of the protocol being used by selecting a
452 // version from |available_versions| which is also supported. Returns true if 463 // version from |available_versions| which is also supported. Returns true if
453 // such a version exists, false otherwise. 464 // such a version exists, false otherwise.
454 bool SelectMutualVersion(const QuicVersionVector& available_versions); 465 bool SelectMutualVersion(const QuicVersionVector& available_versions);
455 466
456 QuicFramer framer_; 467 QuicFramer framer_;
457 468
458 private: 469 private:
459 friend class test::QuicConnectionPeer; 470 friend class test::QuicConnectionPeer;
460 471
472 // Inner helper function to SendvStreamData and
473 // SendvStreamDataAndNotifyWhenAcked.
474 QuicConsumedData SendvStreamDataInner(QuicStreamId id,
475 const struct iovec* iov,
476 int iov_count,
477 QuicStreamOffset offset,
478 bool fin,
479 QuicAckNotifier *notifier);
480
461 // Packets which have not been written to the wire. 481 // Packets which have not been written to the wire.
462 // Owns the QuicPacket* packet. 482 // Owns the QuicPacket* packet.
463 struct QueuedPacket { 483 struct QueuedPacket {
464 QueuedPacket(QuicPacketSequenceNumber sequence_number, 484 QueuedPacket(QuicPacketSequenceNumber sequence_number,
465 QuicPacket* packet, 485 QuicPacket* packet,
466 EncryptionLevel level, 486 EncryptionLevel level,
467 HasRetransmittableData retransmittable) 487 HasRetransmittableData retransmittable,
488 Force forced)
468 : sequence_number(sequence_number), 489 : sequence_number(sequence_number),
469 packet(packet), 490 packet(packet),
470 encryption_level(level), 491 encryption_level(level),
471 retransmittable(retransmittable) { 492 retransmittable(retransmittable),
493 forced(forced) {
472 } 494 }
473 495
474 QuicPacketSequenceNumber sequence_number; 496 QuicPacketSequenceNumber sequence_number;
475 QuicPacket* packet; 497 QuicPacket* packet;
476 const EncryptionLevel encryption_level; 498 const EncryptionLevel encryption_level;
477 HasRetransmittableData retransmittable; 499 HasRetransmittableData retransmittable;
500 Force forced;
478 }; 501 };
479 502
480 struct RetransmissionInfo { 503 struct RetransmissionInfo {
481 RetransmissionInfo(QuicPacketSequenceNumber sequence_number, 504 RetransmissionInfo(QuicPacketSequenceNumber sequence_number,
482 QuicSequenceNumberLength sequence_number_length) 505 QuicSequenceNumberLength sequence_number_length)
483 : sequence_number(sequence_number), 506 : sequence_number(sequence_number),
484 sequence_number_length(sequence_number_length), 507 sequence_number_length(sequence_number_length),
485 number_nacks(0), 508 number_nacks(0),
486 number_retransmissions(0) { 509 number_retransmissions(0) {
487 } 510 }
(...skipping 21 matching lines...) Expand all
509 public: 532 public:
510 bool operator()(const RetransmissionTime& lhs, 533 bool operator()(const RetransmissionTime& lhs,
511 const RetransmissionTime& rhs) const { 534 const RetransmissionTime& rhs) const {
512 DCHECK(lhs.scheduled_time.IsInitialized() && 535 DCHECK(lhs.scheduled_time.IsInitialized() &&
513 rhs.scheduled_time.IsInitialized()); 536 rhs.scheduled_time.IsInitialized());
514 return lhs.scheduled_time > rhs.scheduled_time; 537 return lhs.scheduled_time > rhs.scheduled_time;
515 } 538 }
516 }; 539 };
517 540
518 typedef std::list<QueuedPacket> QueuedPacketList; 541 typedef std::list<QueuedPacket> QueuedPacketList;
519 typedef linked_hash_map<QuicPacketSequenceNumber,
520 RetransmittableFrames*> UnackedPacketMap;
521 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap; 542 typedef std::map<QuicFecGroupNumber, QuicFecGroup*> FecGroupMap;
522 typedef base::hash_map<QuicPacketSequenceNumber,
523 RetransmissionInfo> RetransmissionMap;
524 typedef std::priority_queue<RetransmissionTime, 543 typedef std::priority_queue<RetransmissionTime,
525 std::vector<RetransmissionTime>, 544 std::vector<RetransmissionTime>,
526 RetransmissionTimeComparator> 545 RetransmissionTimeComparator>
527 RetransmissionTimeouts; 546 RetransmissionTimeouts;
528 typedef std::list<QuicAckNotifier*> AckNotifierList; 547 typedef std::list<QuicAckNotifier*> AckNotifierList;
529 548
530 // Sends a version negotiation packet to the peer. 549 // Sends a version negotiation packet to the peer.
531 void SendVersionNegotiationPacket(); 550 void SendVersionNegotiationPacket();
532 551
533 void SetupRetransmission(QuicPacketSequenceNumber sequence_number, 552 void SetupRetransmission(QuicPacketSequenceNumber sequence_number,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 584
566 // Attempts to process any queued undecryptable packets. 585 // Attempts to process any queued undecryptable packets.
567 void MaybeProcessUndecryptablePackets(); 586 void MaybeProcessUndecryptablePackets();
568 587
569 // If a packet can be revived from the current FEC group, then 588 // If a packet can be revived from the current FEC group, then
570 // revive and process the packet. 589 // revive and process the packet.
571 void MaybeProcessRevivedPacket(); 590 void MaybeProcessRevivedPacket();
572 591
573 void ProcessAckFrame(const QuicAckFrame& incoming_ack); 592 void ProcessAckFrame(const QuicAckFrame& incoming_ack);
574 593
575 void HandleAckForSentPackets(const QuicAckFrame& incoming_ack,
576 SequenceNumberSet* acked_packets);
577 void HandleAckForSentFecPackets(const QuicAckFrame& incoming_ack,
578 SequenceNumberSet* acked_packets);
579
580 // Update the |sent_info| for an outgoing ack. 594 // Update the |sent_info| for an outgoing ack.
581 void UpdateSentPacketInfo(SentPacketInfo* sent_info); 595 void UpdateSentPacketInfo(SentPacketInfo* sent_info);
582 596
583 // Checks if the last packet should instigate an ack. 597 // Checks if the last packet should instigate an ack.
584 bool ShouldLastPacketInstigateAck(); 598 bool ShouldLastPacketInstigateAck();
585 599
586 // Sends any packets which are a response to the last packet, including both 600 // Sends any packets which are a response to the last packet, including both
587 // acks and pending writes if an ack opened the congestion window. 601 // acks and pending writes if an ack opened the congestion window.
588 void MaybeSendInResponseToPacket(bool last_packet_should_instigate_ack); 602 void MaybeSendInResponseToPacket(bool last_packet_should_instigate_ack);
589 603
(...skipping 18 matching lines...) Expand all
608 IPEndPoint peer_address_; 622 IPEndPoint peer_address_;
609 623
610 bool last_packet_revived_; // True if the last packet was revived from FEC. 624 bool last_packet_revived_; // True if the last packet was revived from FEC.
611 size_t last_size_; // Size of the last received packet. 625 size_t last_size_; // Size of the last received packet.
612 QuicPacketHeader last_header_; 626 QuicPacketHeader last_header_;
613 std::vector<QuicStreamFrame> last_stream_frames_; 627 std::vector<QuicStreamFrame> last_stream_frames_;
614 std::vector<QuicAckFrame> last_ack_frames_; 628 std::vector<QuicAckFrame> last_ack_frames_;
615 std::vector<QuicCongestionFeedbackFrame> last_congestion_frames_; 629 std::vector<QuicCongestionFeedbackFrame> last_congestion_frames_;
616 std::vector<QuicRstStreamFrame> last_rst_frames_; 630 std::vector<QuicRstStreamFrame> last_rst_frames_;
617 std::vector<QuicGoAwayFrame> last_goaway_frames_; 631 std::vector<QuicGoAwayFrame> last_goaway_frames_;
632 // Then number of packets retransmitted because of nacks
633 // while processed the current ack frame.
634 size_t retransmitted_nacked_packet_count_;
618 635
619 QuicCongestionFeedbackFrame outgoing_congestion_feedback_; 636 QuicCongestionFeedbackFrame outgoing_congestion_feedback_;
620 637
621 // Track some peer state so we can do less bookkeeping 638 // Track some peer state so we can do less bookkeeping
622 // Largest sequence sent by the peer which had an ack frame (latest ack info). 639 // Largest sequence sent by the peer which had an ack frame (latest ack info).
623 QuicPacketSequenceNumber largest_seen_packet_with_ack_; 640 QuicPacketSequenceNumber largest_seen_packet_with_ack_;
624 641
625 // When new packets are created which may be retransmitted, they are added
626 // to this map, which contains owning pointers to the contained frames.
627 UnackedPacketMap unacked_packets_;
628
629 // Pending fec packets that have not been acked yet. These packets need to be
630 // cleared out of the cgst_window after a timeout since FEC packets are never
631 // retransmitted.
632 // Ask: What should be the timeout for these packets?
633 UnackedPacketMap unacked_fec_packets_;
634
635 // Collection of packets which were received before encryption was 642 // Collection of packets which were received before encryption was
636 // established, but which could not be decrypted. We buffer these on 643 // established, but which could not be decrypted. We buffer these on
637 // the assumption that they could not be processed because they were 644 // the assumption that they could not be processed because they were
638 // sent with the INITIAL encryption and the CHLO message was lost. 645 // sent with the INITIAL encryption and the CHLO message was lost.
639 std::deque<QuicEncryptedPacket*> undecryptable_packets_; 646 std::deque<QuicEncryptedPacket*> undecryptable_packets_;
640 647
641 // Heap of packets that we might need to retransmit, and the time at 648 // Heap of packets that we might need to retransmit, and the time at
642 // which we should retransmit them. Every time a packet is sent it is added 649 // which we should retransmit them. Every time a packet is sent it is added
643 // to this heap which is O(log(number of pending packets to be retransmitted)) 650 // to this heap which is O(log(number of pending packets to be retransmitted))
644 // which might be costly. This should be optimized to O(1) by maintaining a 651 // which might be costly. This should be optimized to O(1) by maintaining a
645 // priority queue of lists of packets to be retransmitted, where list x 652 // priority queue of lists of packets to be retransmitted, where list x
646 // contains all packets that have been retransmitted x times. 653 // contains all packets that have been retransmitted x times.
647 RetransmissionTimeouts retransmission_timeouts_; 654 RetransmissionTimeouts retransmission_timeouts_;
648 655
649 // Map from sequence number to the retransmission info.
650 RetransmissionMap retransmission_map_;
651
652 // True while OnRetransmissionTimeout is running to prevent 656 // True while OnRetransmissionTimeout is running to prevent
653 // SetRetransmissionAlarm from being called erroneously. 657 // SetRetransmissionAlarm from being called erroneously.
654 bool handling_retransmission_timeout_; 658 bool handling_retransmission_timeout_;
655 659
656 // When packets could not be sent because the socket was not writable, 660 // When packets could not be sent because the socket was not writable,
657 // they are added to this list. All corresponding frames are in 661 // they are added to this list. All corresponding frames are in
658 // unacked_packets_ if they are to be retransmitted. 662 // unacked_packets_ if they are to be retransmitted.
659 QueuedPacketList queued_packets_; 663 QueuedPacketList queued_packets_;
660 664
661 // True when the socket becomes unwritable. 665 // True when the socket becomes unwritable.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 // This is used for timeouts, and does not indicate the packet was processed. 699 // This is used for timeouts, and does not indicate the packet was processed.
696 QuicTime time_of_last_received_packet_; 700 QuicTime time_of_last_received_packet_;
697 701
698 // The time that we last sent a packet for this connection. 702 // The time that we last sent a packet for this connection.
699 QuicTime time_of_last_sent_packet_; 703 QuicTime time_of_last_sent_packet_;
700 704
701 // Congestion manager which controls the rate the connection sends packets 705 // Congestion manager which controls the rate the connection sends packets
702 // as well as collecting and generating congestion feedback. 706 // as well as collecting and generating congestion feedback.
703 QuicCongestionManager congestion_manager_; 707 QuicCongestionManager congestion_manager_;
704 708
709 // Sent packet manager which tracks the status of packets sent by this
710 // connection.
711 QuicSentPacketManager sent_packet_manager_;
712
705 // The state of connection in version negotiation finite state machine. 713 // The state of connection in version negotiation finite state machine.
706 QuicVersionNegotiationState version_negotiation_state_; 714 QuicVersionNegotiationState version_negotiation_state_;
707 715
708 size_t max_packets_per_retransmission_alarm_; 716 size_t max_packets_per_retransmission_alarm_;
709 717
710 // Tracks if the connection was created by the server. 718 // Tracks if the connection was created by the server.
711 bool is_server_; 719 bool is_server_;
712 720
713 // True by default. False if we've received or sent an explicit connection 721 // True by default. False if we've received or sent an explicit connection
714 // close. 722 // close.
(...skipping 13 matching lines...) Expand all
728 // Once a given QuicAckNotifier has seen all the sequence numbers it is 736 // Once a given QuicAckNotifier has seen all the sequence numbers it is
729 // interested in, it will be deleted, and removed from this list. 737 // interested in, it will be deleted, and removed from this list.
730 AckNotifierList ack_notifiers_; 738 AckNotifierList ack_notifiers_;
731 739
732 DISALLOW_COPY_AND_ASSIGN(QuicConnection); 740 DISALLOW_COPY_AND_ASSIGN(QuicConnection);
733 }; 741 };
734 742
735 } // namespace net 743 } // namespace net
736 744
737 #endif // NET_QUIC_QUIC_CONNECTION_H_ 745 #endif // NET_QUIC_QUIC_CONNECTION_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/send_algorithm_interface.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698