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

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

Issue 180383004: Create QUIC_VERSION_16 which breaks the sent_info field out of the ACK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added logging for WINDOW_UPDATE and BLOCKED frames Created 6 years, 10 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/quic_connection.h ('k') | net/quic/quic_connection_logger.h » ('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 #include "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 helper->GetClock()->ApproximateNow(), 172 helper->GetClock()->ApproximateNow(),
173 is_server), 173 is_server),
174 helper_(helper), 174 helper_(helper),
175 writer_(writer), 175 writer_(writer),
176 encryption_level_(ENCRYPTION_NONE), 176 encryption_level_(ENCRYPTION_NONE),
177 clock_(helper->GetClock()), 177 clock_(helper->GetClock()),
178 random_generator_(helper->GetRandomGenerator()), 178 random_generator_(helper->GetRandomGenerator()),
179 guid_(guid), 179 guid_(guid),
180 peer_address_(address), 180 peer_address_(address),
181 largest_seen_packet_with_ack_(0), 181 largest_seen_packet_with_ack_(0),
182 largest_seen_packet_with_stop_waiting_(0),
182 pending_version_negotiation_packet_(false), 183 pending_version_negotiation_packet_(false),
183 received_packet_manager_(kTCP), 184 received_packet_manager_(kTCP),
184 ack_queued_(false), 185 ack_queued_(false),
185 stop_waiting_count_(0), 186 stop_waiting_count_(0),
186 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))), 187 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))),
187 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))), 188 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))),
188 send_alarm_(helper->CreateAlarm(new SendAlarm(this))), 189 send_alarm_(helper->CreateAlarm(new SendAlarm(this))),
189 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))), 190 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))),
190 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))), 191 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))),
191 debug_visitor_(NULL), 192 debug_visitor_(NULL),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 256 }
256 SendConnectionCloseWithDetails(framer->error(), framer->detailed_error()); 257 SendConnectionCloseWithDetails(framer->error(), framer->detailed_error());
257 } 258 }
258 259
259 void QuicConnection::OnPacket() { 260 void QuicConnection::OnPacket() {
260 DCHECK(last_stream_frames_.empty() && 261 DCHECK(last_stream_frames_.empty() &&
261 last_goaway_frames_.empty() && 262 last_goaway_frames_.empty() &&
262 last_window_update_frames_.empty() && 263 last_window_update_frames_.empty() &&
263 last_rst_frames_.empty() && 264 last_rst_frames_.empty() &&
264 last_ack_frames_.empty() && 265 last_ack_frames_.empty() &&
265 last_congestion_frames_.empty()); 266 last_congestion_frames_.empty() &&
267 last_stop_waiting_frames_.empty());
266 } 268 }
267 269
268 void QuicConnection::OnPublicResetPacket( 270 void QuicConnection::OnPublicResetPacket(
269 const QuicPublicResetPacket& packet) { 271 const QuicPublicResetPacket& packet) {
270 if (debug_visitor_) { 272 if (debug_visitor_) {
271 debug_visitor_->OnPublicResetPacket(packet); 273 debug_visitor_->OnPublicResetPacket(packet);
272 } 274 }
273 CloseConnection(QUIC_PUBLIC_RESET, true); 275 CloseConnection(QUIC_PUBLIC_RESET, true);
274 } 276 }
275 277
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 SendConnectionClose(QUIC_INVALID_ACK_DATA); 488 SendConnectionClose(QUIC_INVALID_ACK_DATA);
487 return false; 489 return false;
488 } 490 }
489 491
490 last_ack_frames_.push_back(incoming_ack); 492 last_ack_frames_.push_back(incoming_ack);
491 return connected_; 493 return connected_;
492 } 494 }
493 495
494 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) { 496 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) {
495 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number; 497 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number;
496
497 received_packet_manager_.UpdatePacketInformationReceivedByPeer( 498 received_packet_manager_.UpdatePacketInformationReceivedByPeer(
498 incoming_ack.received_info); 499 incoming_ack.received_info);
499 received_packet_manager_.UpdatePacketInformationSentByPeer( 500 if (version() <= QUIC_VERSION_15) {
500 incoming_ack.sent_info); 501 ProcessStopWaitingFrame(incoming_ack.sent_info);
501 // Possibly close any FecGroups which are now irrelevant. 502 }
502 CloseFecGroupsBefore(incoming_ack.sent_info.least_unacked + 1);
503 503
504 sent_entropy_manager_.ClearEntropyBefore( 504 sent_entropy_manager_.ClearEntropyBefore(
505 received_packet_manager_.least_packet_awaited_by_peer() - 1); 505 received_packet_manager_.least_packet_awaited_by_peer() - 1);
506 506
507 bool reset_retransmission_alarm = 507 bool reset_retransmission_alarm =
508 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info, 508 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info,
509 time_of_last_received_packet_); 509 time_of_last_received_packet_);
510 if (sent_packet_manager_.HasPendingRetransmissions()) { 510 if (sent_packet_manager_.HasPendingRetransmissions()) {
511 WriteIfNotBlocked(); 511 WriteIfNotBlocked();
512 } 512 }
513 513
514 if (reset_retransmission_alarm) { 514 if (reset_retransmission_alarm) {
515 retransmission_alarm_->Cancel(); 515 retransmission_alarm_->Cancel();
516 QuicTime retransmission_time = 516 QuicTime retransmission_time =
517 sent_packet_manager_.GetRetransmissionTime(); 517 sent_packet_manager_.GetRetransmissionTime();
518 if (retransmission_time != QuicTime::Zero()) { 518 if (retransmission_time != QuicTime::Zero()) {
519 retransmission_alarm_->Set(retransmission_time); 519 retransmission_alarm_->Set(retransmission_time);
520 } 520 }
521 } 521 }
522 } 522 }
523 523
524 void QuicConnection::ProcessStopWaitingFrame(
525 const QuicStopWaitingFrame& stop_waiting) {
526 largest_seen_packet_with_stop_waiting_ = last_header_.packet_sequence_number;
527 received_packet_manager_.UpdatePacketInformationSentByPeer(stop_waiting);
528 // Possibly close any FecGroups which are now irrelevant.
529 CloseFecGroupsBefore(stop_waiting.least_unacked + 1);
530 }
531
524 bool QuicConnection::OnCongestionFeedbackFrame( 532 bool QuicConnection::OnCongestionFeedbackFrame(
525 const QuicCongestionFeedbackFrame& feedback) { 533 const QuicCongestionFeedbackFrame& feedback) {
526 DCHECK(connected_); 534 DCHECK(connected_);
527 if (debug_visitor_) { 535 if (debug_visitor_) {
528 debug_visitor_->OnCongestionFeedbackFrame(feedback); 536 debug_visitor_->OnCongestionFeedbackFrame(feedback);
529 } 537 }
530 last_congestion_frames_.push_back(feedback); 538 last_congestion_frames_.push_back(feedback);
531 return connected_; 539 return connected_;
532 } 540 }
533 541
542 bool QuicConnection::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) {
543 DCHECK(connected_);
544
545 if (last_header_.packet_sequence_number <=
546 largest_seen_packet_with_stop_waiting_) {
547 DVLOG(1) << ENDPOINT << "Received an old stop waiting frame: ignoring";
548 return true;
549 }
550
551 if (!ValidateStopWaitingFrame(frame)) {
552 SendConnectionClose(QUIC_INVALID_STOP_WAITING_DATA);
553 return false;
554 }
555
556 if (debug_visitor_) {
557 debug_visitor_->OnStopWaitingFrame(frame);
558 }
559
560 last_stop_waiting_frames_.push_back(frame);
561 return connected_;
562 }
563
534 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { 564 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
535 if (incoming_ack.received_info.largest_observed > 565 if (incoming_ack.received_info.largest_observed >
536 packet_creator_.sequence_number()) { 566 packet_creator_.sequence_number()) {
537 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:" 567 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:"
538 << incoming_ack.received_info.largest_observed << " vs " 568 << incoming_ack.received_info.largest_observed << " vs "
539 << packet_creator_.sequence_number(); 569 << packet_creator_.sequence_number();
540 // We got an error for data we have not sent. Error out. 570 // We got an error for data we have not sent. Error out.
541 return false; 571 return false;
542 } 572 }
543 573
544 if (incoming_ack.received_info.largest_observed < 574 if (incoming_ack.received_info.largest_observed <
545 received_packet_manager_.peer_largest_observed_packet()) { 575 received_packet_manager_.peer_largest_observed_packet()) {
546 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:" 576 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:"
547 << incoming_ack.received_info.largest_observed << " vs " 577 << incoming_ack.received_info.largest_observed << " vs "
548 << received_packet_manager_.peer_largest_observed_packet(); 578 << received_packet_manager_.peer_largest_observed_packet();
549 // A new ack has a diminished largest_observed value. Error out. 579 // A new ack has a diminished largest_observed value. Error out.
550 // If this was an old packet, we wouldn't even have checked. 580 // If this was an old packet, we wouldn't even have checked.
551 return false; 581 return false;
552 } 582 }
553 583
554 if (incoming_ack.sent_info.least_unacked < 584 if (version() <= QUIC_VERSION_15) {
555 received_packet_manager_.peer_least_packet_awaiting_ack()) { 585 if (!ValidateStopWaitingFrame(incoming_ack.sent_info)) {
556 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: " 586 return false;
557 << incoming_ack.sent_info.least_unacked << " vs " 587 }
558 << received_packet_manager_.peer_least_packet_awaiting_ack();
559 // We never process old ack frames, so this number should only increase.
560 return false;
561 }
562
563 if (incoming_ack.sent_info.least_unacked >
564 last_header_.packet_sequence_number) {
565 DLOG(ERROR) << ENDPOINT << "Peer sent least_unacked:"
566 << incoming_ack.sent_info.least_unacked
567 << " greater than the enclosing packet sequence number:"
568 << last_header_.packet_sequence_number;
569 return false;
570 } 588 }
571 589
572 if (!incoming_ack.received_info.missing_packets.empty() && 590 if (!incoming_ack.received_info.missing_packets.empty() &&
573 *incoming_ack.received_info.missing_packets.rbegin() > 591 *incoming_ack.received_info.missing_packets.rbegin() >
574 incoming_ack.received_info.largest_observed) { 592 incoming_ack.received_info.largest_observed) {
575 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: " 593 DLOG(ERROR) << ENDPOINT << "Peer sent missing packet: "
576 << *incoming_ack.received_info.missing_packets.rbegin() 594 << *incoming_ack.received_info.missing_packets.rbegin()
577 << " which is greater than largest observed: " 595 << " which is greater than largest observed: "
578 << incoming_ack.received_info.largest_observed; 596 << incoming_ack.received_info.largest_observed;
579 return false; 597 return false;
(...skipping 22 matching lines...) Expand all
602 iter != incoming_ack.received_info.revived_packets.end(); ++iter) { 620 iter != incoming_ack.received_info.revived_packets.end(); ++iter) {
603 if (!ContainsKey(incoming_ack.received_info.missing_packets, *iter)) { 621 if (!ContainsKey(incoming_ack.received_info.missing_packets, *iter)) {
604 DLOG(ERROR) << ENDPOINT 622 DLOG(ERROR) << ENDPOINT
605 << "Peer specified revived packet which was not missing."; 623 << "Peer specified revived packet which was not missing.";
606 return false; 624 return false;
607 } 625 }
608 } 626 }
609 return true; 627 return true;
610 } 628 }
611 629
630 bool QuicConnection::ValidateStopWaitingFrame(
631 const QuicStopWaitingFrame& stop_waiting) {
632 if (stop_waiting.least_unacked <
633 received_packet_manager_.peer_least_packet_awaiting_ack()) {
634 DLOG(ERROR) << ENDPOINT << "Peer's sent low least_unacked: "
635 << stop_waiting.least_unacked << " vs "
636 << received_packet_manager_.peer_least_packet_awaiting_ack();
637 // We never process old ack frames, so this number should only increase.
638 return false;
639 }
640
641 if (stop_waiting.least_unacked >
642 last_header_.packet_sequence_number) {
643 DLOG(ERROR) << ENDPOINT << "Peer sent least_unacked:"
644 << stop_waiting.least_unacked
645 << " greater than the enclosing packet sequence number:"
646 << last_header_.packet_sequence_number;
647 return false;
648 }
649
650 return true;
651 }
652
612 void QuicConnection::OnFecData(const QuicFecData& fec) { 653 void QuicConnection::OnFecData(const QuicFecData& fec) {
613 DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group); 654 DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group);
614 DCHECK_NE(0u, last_header_.fec_group); 655 DCHECK_NE(0u, last_header_.fec_group);
615 QuicFecGroup* group = GetFecGroup(); 656 QuicFecGroup* group = GetFecGroup();
616 if (group != NULL) { 657 if (group != NULL) {
617 group->UpdateFec(last_header_.packet_sequence_number, fec); 658 group->UpdateFec(last_header_.packet_sequence_number, fec);
618 } 659 }
619 } 660 }
620 661
621 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { 662 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 // Don't do anything if this packet closed the connection. 712 // Don't do anything if this packet closed the connection.
672 if (!connected_) { 713 if (!connected_) {
673 ClearLastFrames(); 714 ClearLastFrames();
674 return; 715 return;
675 } 716 }
676 717
677 DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got") 718 DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got")
678 << " packet " << last_header_.packet_sequence_number 719 << " packet " << last_header_.packet_sequence_number
679 << " with " << last_ack_frames_.size() << " acks, " 720 << " with " << last_ack_frames_.size() << " acks, "
680 << last_congestion_frames_.size() << " congestions, " 721 << last_congestion_frames_.size() << " congestions, "
722 << last_stop_waiting_frames_.size() << " stop_waiting, "
681 << last_goaway_frames_.size() << " goaways, " 723 << last_goaway_frames_.size() << " goaways, "
682 << last_window_update_frames_.size() << " window updates, " 724 << last_window_update_frames_.size() << " window updates, "
683 << last_rst_frames_.size() << " rsts, " 725 << last_rst_frames_.size() << " rsts, "
726 << last_blocked_frames_.size() << " blocked, "
727 << last_rst_frames_.size() << " rsts, "
684 << last_close_frames_.size() << " closes, " 728 << last_close_frames_.size() << " closes, "
685 << last_stream_frames_.size() 729 << last_stream_frames_.size()
686 << " stream frames for " << last_header_.public_header.guid; 730 << " stream frames for " << last_header_.public_header.guid;
687 731
688 MaybeQueueAck(); 732 MaybeQueueAck();
689 733
690 // Discard the packet if the visitor fails to process the stream frames. 734 // Discard the packet if the visitor fails to process the stream frames.
691 if (!last_stream_frames_.empty() && 735 if (!last_stream_frames_.empty() &&
692 !visitor_->OnStreamFrames(last_stream_frames_)) { 736 !visitor_->OnStreamFrames(last_stream_frames_)) {
693 return; 737 return;
(...skipping 25 matching lines...) Expand all
719 for (size_t i = 0; i < last_rst_frames_.size(); ++i) { 763 for (size_t i = 0; i < last_rst_frames_.size(); ++i) {
720 visitor_->OnRstStream(last_rst_frames_[i]); 764 visitor_->OnRstStream(last_rst_frames_[i]);
721 } 765 }
722 for (size_t i = 0; i < last_ack_frames_.size(); ++i) { 766 for (size_t i = 0; i < last_ack_frames_.size(); ++i) {
723 ProcessAckFrame(last_ack_frames_[i]); 767 ProcessAckFrame(last_ack_frames_[i]);
724 } 768 }
725 for (size_t i = 0; i < last_congestion_frames_.size(); ++i) { 769 for (size_t i = 0; i < last_congestion_frames_.size(); ++i) {
726 sent_packet_manager_.OnIncomingQuicCongestionFeedbackFrame( 770 sent_packet_manager_.OnIncomingQuicCongestionFeedbackFrame(
727 last_congestion_frames_[i], time_of_last_received_packet_); 771 last_congestion_frames_[i], time_of_last_received_packet_);
728 } 772 }
773 for (size_t i = 0; i < last_stop_waiting_frames_.size(); ++i) {
774 ProcessStopWaitingFrame(last_stop_waiting_frames_[i]);
775 }
729 if (!last_close_frames_.empty()) { 776 if (!last_close_frames_.empty()) {
730 CloseConnection(last_close_frames_[0].error_code, true); 777 CloseConnection(last_close_frames_[0].error_code, true);
731 DCHECK(!connected_); 778 DCHECK(!connected_);
732 } 779 }
733 780
734 // If there are new missing packets to report, send an ack immediately. 781 // If there are new missing packets to report, send an ack immediately.
735 if (received_packet_manager_.HasNewMissingPackets()) { 782 if (received_packet_manager_.HasNewMissingPackets()) {
736 ack_queued_ = true; 783 ack_queued_ = true;
737 ack_alarm_->Cancel(); 784 ack_alarm_->Cancel();
738 } 785 }
(...skipping 22 matching lines...) Expand all
761 ack_alarm_->Cancel(); 808 ack_alarm_->Cancel();
762 } 809 }
763 } 810 }
764 811
765 void QuicConnection::ClearLastFrames() { 812 void QuicConnection::ClearLastFrames() {
766 last_stream_frames_.clear(); 813 last_stream_frames_.clear();
767 last_goaway_frames_.clear(); 814 last_goaway_frames_.clear();
768 last_window_update_frames_.clear(); 815 last_window_update_frames_.clear();
769 last_rst_frames_.clear(); 816 last_rst_frames_.clear();
770 last_ack_frames_.clear(); 817 last_ack_frames_.clear();
818 last_stop_waiting_frames_.clear();
771 last_congestion_frames_.clear(); 819 last_congestion_frames_.clear();
772 } 820 }
773 821
774 QuicAckFrame* QuicConnection::CreateAckFrame() { 822 QuicAckFrame* QuicConnection::CreateAckFrame() {
775 QuicAckFrame* outgoing_ack = new QuicAckFrame(); 823 QuicAckFrame* outgoing_ack = new QuicAckFrame();
776 received_packet_manager_.UpdateReceivedPacketInfo( 824 received_packet_manager_.UpdateReceivedPacketInfo(
777 &(outgoing_ack->received_info), clock_->ApproximateNow()); 825 &(outgoing_ack->received_info), clock_->ApproximateNow());
778 UpdateSentPacketInfo(&(outgoing_ack->sent_info)); 826 UpdateStopWaiting(&(outgoing_ack->sent_info));
779 DVLOG(1) << ENDPOINT << "Creating ack frame: " << *outgoing_ack; 827 DVLOG(1) << ENDPOINT << "Creating ack frame: " << *outgoing_ack;
780 return outgoing_ack; 828 return outgoing_ack;
781 } 829 }
782 830
783 QuicCongestionFeedbackFrame* QuicConnection::CreateFeedbackFrame() { 831 QuicCongestionFeedbackFrame* QuicConnection::CreateFeedbackFrame() {
784 return new QuicCongestionFeedbackFrame(outgoing_congestion_feedback_); 832 return new QuicCongestionFeedbackFrame(outgoing_congestion_feedback_);
785 } 833 }
786 834
835 QuicStopWaitingFrame* QuicConnection::CreateStopWaitingFrame() {
836 QuicStopWaitingFrame stop_waiting;
837 UpdateStopWaiting(&stop_waiting);
838 return new QuicStopWaitingFrame(stop_waiting);
839 }
840
787 bool QuicConnection::ShouldLastPacketInstigateAck() const { 841 bool QuicConnection::ShouldLastPacketInstigateAck() const {
788 if (!last_stream_frames_.empty() || 842 if (!last_stream_frames_.empty() ||
789 !last_goaway_frames_.empty() || 843 !last_goaway_frames_.empty() ||
790 !last_rst_frames_.empty()) { 844 !last_rst_frames_.empty()) {
791 return true; 845 return true;
792 } 846 }
793 847
794 if (!last_ack_frames_.empty() && 848 if (!last_ack_frames_.empty() &&
795 last_ack_frames_.back().received_info.is_truncated) { 849 last_ack_frames_.back().received_info.is_truncated) {
796 return true; 850 return true;
797 } 851 }
798
799 return false; 852 return false;
800 } 853 }
801 854
802 void QuicConnection::UpdateStopWaitingCount() { 855 void QuicConnection::UpdateStopWaitingCount() {
803 if (last_ack_frames_.empty()) { 856 if (last_ack_frames_.empty()) {
804 return; 857 return;
805 } 858 }
806 859
807 // If the peer is still waiting for a packet that we are no longer planning to 860 // If the peer is still waiting for a packet that we are no longer planning to
808 // send, send an ack to raise the high water mark. 861 // send, send an ack to raise the high water mark.
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 if ((queued_packet.type == CONNECTION_CLOSE || queued_packets_.empty()) && 1427 if ((queued_packet.type == CONNECTION_CLOSE || queued_packets_.empty()) &&
1375 WritePacket(queued_packet)) { 1428 WritePacket(queued_packet)) {
1376 delete packet.packet; 1429 delete packet.packet;
1377 return true; 1430 return true;
1378 } 1431 }
1379 queued_packet.type = QUEUED; 1432 queued_packet.type = QUEUED;
1380 queued_packets_.push_back(queued_packet); 1433 queued_packets_.push_back(queued_packet);
1381 return false; 1434 return false;
1382 } 1435 }
1383 1436
1384 void QuicConnection::UpdateSentPacketInfo(SentPacketInfo* sent_info) { 1437 void QuicConnection::UpdateStopWaiting(QuicStopWaitingFrame* stop_waiting) {
1385 sent_info->least_unacked = GetLeastUnacked(); 1438 stop_waiting->least_unacked = GetLeastUnacked();
1386 sent_info->entropy_hash = sent_entropy_manager_.EntropyHash( 1439 stop_waiting->entropy_hash = sent_entropy_manager_.EntropyHash(
1387 sent_info->least_unacked - 1); 1440 stop_waiting->least_unacked - 1);
1388 } 1441 }
1389 1442
1390 void QuicConnection::SendAck() { 1443 void QuicConnection::SendAck() {
1391 ack_alarm_->Cancel(); 1444 ack_alarm_->Cancel();
1392 stop_waiting_count_ = 0; 1445 stop_waiting_count_ = 0;
1393 // TODO(rch): delay this until the CreateFeedbackFrame 1446 // TODO(rch): delay this until the CreateFeedbackFrame
1394 // method is invoked. This requires changes SetShouldSendAck 1447 // method is invoked. This requires changes SetShouldSendAck
1395 // to be a no-arg method, and re-jiggering its implementation. 1448 // to be a no-arg method, and re-jiggering its implementation.
1396 bool send_feedback = false; 1449 bool send_feedback = false;
1397 if (received_packet_manager_.GenerateCongestionFeedback( 1450 if (received_packet_manager_.GenerateCongestionFeedback(
1398 &outgoing_congestion_feedback_)) { 1451 &outgoing_congestion_feedback_)) {
1399 DVLOG(1) << ENDPOINT << "Sending feedback: " 1452 DVLOG(1) << ENDPOINT << "Sending feedback: "
1400 << outgoing_congestion_feedback_; 1453 << outgoing_congestion_feedback_;
1401 send_feedback = true; 1454 send_feedback = true;
1402 } 1455 }
1403 1456
1404 packet_generator_.SetShouldSendAck(send_feedback); 1457 packet_generator_.SetShouldSendAck(send_feedback,
1458 version() > QUIC_VERSION_15);
1405 } 1459 }
1406 1460
1407 void QuicConnection::OnRetransmissionTimeout() { 1461 void QuicConnection::OnRetransmissionTimeout() {
1408 if (!sent_packet_manager_.HasUnackedPackets()) { 1462 if (!sent_packet_manager_.HasUnackedPackets()) {
1409 return; 1463 return;
1410 } 1464 }
1411 1465
1412 sent_packet_manager_.OnRetransmissionTimeout(); 1466 sent_packet_manager_.OnRetransmissionTimeout();
1413 1467
1414 WriteIfNotBlocked(); 1468 WriteIfNotBlocked();
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 // If we changed the generator's batch state, restore original batch state. 1776 // If we changed the generator's batch state, restore original batch state.
1723 if (!already_in_batch_mode_) { 1777 if (!already_in_batch_mode_) {
1724 DVLOG(1) << "Leaving Batch Mode."; 1778 DVLOG(1) << "Leaving Batch Mode.";
1725 connection_->packet_generator_.FinishBatchOperations(); 1779 connection_->packet_generator_.FinishBatchOperations();
1726 } 1780 }
1727 DCHECK_EQ(already_in_batch_mode_, 1781 DCHECK_EQ(already_in_batch_mode_,
1728 connection_->packet_generator_.InBatchMode()); 1782 connection_->packet_generator_.InBatchMode());
1729 } 1783 }
1730 1784
1731 } // namespace net 1785 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_logger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698