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

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

Issue 157803007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_x64 compiler error fix 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/crypto/strike_register.cc ('k') | net/quic/quic_connection_test.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 #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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) { 362 bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
363 return true; 363 return true;
364 } 364 }
365 365
366 bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) { 366 bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
367 if (debug_visitor_) { 367 if (debug_visitor_) {
368 debug_visitor_->OnPacketHeader(header); 368 debug_visitor_->OnPacketHeader(header);
369 } 369 }
370 370
371 if (header.fec_flag && framer_.version() <= QUIC_VERSION_14) {
372 DLOG(WARNING) << "Ignoring FEC packets for versions prior to 15.";
373 return false;
374 }
375
371 if (!ProcessValidatedPacket()) { 376 if (!ProcessValidatedPacket()) {
372 return false; 377 return false;
373 } 378 }
374 379
375 // Will be decrement below if we fall through to return true; 380 // Will be decrement below if we fall through to return true;
376 ++stats_.packets_dropped; 381 ++stats_.packets_dropped;
377 382
378 if (header.public_header.guid != guid_) { 383 if (header.public_header.guid != guid_) {
379 DVLOG(1) << ENDPOINT << "Ignoring packet from unexpected GUID: " 384 DVLOG(1) << ENDPOINT << "Ignoring packet from unexpected GUID: "
380 << header.public_header.guid << " instead of " << guid_; 385 << header.public_header.guid << " instead of " << guid_;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return false; 471 return false;
467 } 472 }
468 473
469 last_ack_frames_.push_back(incoming_ack); 474 last_ack_frames_.push_back(incoming_ack);
470 return connected_; 475 return connected_;
471 } 476 }
472 477
473 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) { 478 void QuicConnection::ProcessAckFrame(const QuicAckFrame& incoming_ack) {
474 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number; 479 largest_seen_packet_with_ack_ = last_header_.packet_sequence_number;
475 480
476 received_packet_manager_.UpdatePacketInformationReceivedByPeer(incoming_ack); 481 received_packet_manager_.UpdatePacketInformationReceivedByPeer(
477 received_packet_manager_.UpdatePacketInformationSentByPeer(incoming_ack); 482 incoming_ack.received_info);
483 received_packet_manager_.UpdatePacketInformationSentByPeer(
484 incoming_ack.sent_info);
478 // Possibly close any FecGroups which are now irrelevant. 485 // Possibly close any FecGroups which are now irrelevant.
479 CloseFecGroupsBefore(incoming_ack.sent_info.least_unacked + 1); 486 CloseFecGroupsBefore(incoming_ack.sent_info.least_unacked + 1);
480 487
481 sent_entropy_manager_.ClearEntropyBefore( 488 sent_entropy_manager_.ClearEntropyBefore(
482 received_packet_manager_.least_packet_awaited_by_peer() - 1); 489 received_packet_manager_.least_packet_awaited_by_peer() - 1);
483 490
484 bool reset_retransmission_alarm = 491 bool reset_retransmission_alarm =
485 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info, 492 sent_packet_manager_.OnIncomingAck(incoming_ack.received_info,
486 time_of_last_received_packet_); 493 time_of_last_received_packet_);
487 if (sent_packet_manager_.HasPendingRetransmissions()) { 494 if (sent_packet_manager_.HasPendingRetransmissions()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 574 }
568 575
569 if (!sent_entropy_manager_.IsValidEntropy( 576 if (!sent_entropy_manager_.IsValidEntropy(
570 incoming_ack.received_info.largest_observed, 577 incoming_ack.received_info.largest_observed,
571 incoming_ack.received_info.missing_packets, 578 incoming_ack.received_info.missing_packets,
572 incoming_ack.received_info.entropy_hash)) { 579 incoming_ack.received_info.entropy_hash)) {
573 DLOG(ERROR) << ENDPOINT << "Peer sent invalid entropy."; 580 DLOG(ERROR) << ENDPOINT << "Peer sent invalid entropy.";
574 return false; 581 return false;
575 } 582 }
576 583
584 for (SequenceNumberSet::const_iterator iter =
585 incoming_ack.received_info.revived_packets.begin();
586 iter != incoming_ack.received_info.revived_packets.end(); ++iter) {
587 if (!ContainsKey(incoming_ack.received_info.missing_packets, *iter)) {
588 DLOG(ERROR) << ENDPOINT
589 << "Peer specified revived packet which was not missing.";
590 return false;
591 }
592 }
577 return true; 593 return true;
578 } 594 }
579 595
580 void QuicConnection::OnFecData(const QuicFecData& fec) { 596 void QuicConnection::OnFecData(const QuicFecData& fec) {
581 DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group); 597 DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group);
582 DCHECK_NE(0u, last_header_.fec_group); 598 DCHECK_NE(0u, last_header_.fec_group);
583 QuicFecGroup* group = GetFecGroup(); 599 QuicFecGroup* group = GetFecGroup();
584 if (group != NULL) { 600 if (group != NULL) {
585 group->UpdateFec(last_header_.packet_sequence_number, 601 group->UpdateFec(last_header_.packet_sequence_number, fec);
586 last_header_.entropy_flag, fec);
587 } 602 }
588 } 603 }
589 604
590 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) { 605 bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
591 DCHECK(connected_); 606 DCHECK(connected_);
592 if (debug_visitor_) { 607 if (debug_visitor_) {
593 debug_visitor_->OnRstStreamFrame(frame); 608 debug_visitor_->OnRstStreamFrame(frame);
594 } 609 }
595 DVLOG(1) << ENDPOINT << "Stream reset with error " 610 DVLOG(1) << ENDPOINT << "Stream reset with error "
596 << QuicUtils::StreamErrorToString(frame.error_code); 611 << QuicUtils::StreamErrorToString(frame.error_code);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 << " stream frames for " << last_header_.public_header.guid; 653 << " stream frames for " << last_header_.public_header.guid;
639 654
640 MaybeQueueAck(); 655 MaybeQueueAck();
641 656
642 // Discard the packet if the visitor fails to process the stream frames. 657 // Discard the packet if the visitor fails to process the stream frames.
643 if (!last_stream_frames_.empty() && 658 if (!last_stream_frames_.empty() &&
644 !visitor_->OnStreamFrames(last_stream_frames_)) { 659 !visitor_->OnStreamFrames(last_stream_frames_)) {
645 return; 660 return;
646 } 661 }
647 662
648 received_packet_manager_.RecordPacketReceived(last_size_, 663 if (last_packet_revived_) {
649 last_header_, 664 received_packet_manager_.RecordPacketRevived(
650 time_of_last_received_packet_, 665 last_header_.packet_sequence_number);
651 last_packet_revived_); 666 } else {
667 received_packet_manager_.RecordPacketReceived(
668 last_size_, last_header_, time_of_last_received_packet_);
669 }
652 for (size_t i = 0; i < last_stream_frames_.size(); ++i) { 670 for (size_t i = 0; i < last_stream_frames_.size(); ++i) {
653 stats_.stream_bytes_received += 671 stats_.stream_bytes_received +=
654 last_stream_frames_[i].data.TotalBufferSize(); 672 last_stream_frames_[i].data.TotalBufferSize();
655 } 673 }
656 674
657 // Process stream resets, then acks, then congestion feedback. 675 // Process stream resets, then acks, then congestion feedback.
658 for (size_t i = 0; i < last_goaway_frames_.size(); ++i) { 676 for (size_t i = 0; i < last_goaway_frames_.size(); ++i) {
659 visitor_->OnGoAway(last_goaway_frames_[i]); 677 visitor_->OnGoAway(last_goaway_frames_[i]);
660 } 678 }
661 for (size_t i = 0; i < last_rst_frames_.size(); ++i) { 679 for (size_t i = 0; i < last_rst_frames_.size(); ++i) {
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 // If we changed the generator's batch state, restore original batch state. 1683 // If we changed the generator's batch state, restore original batch state.
1666 if (!already_in_batch_mode_) { 1684 if (!already_in_batch_mode_) {
1667 DVLOG(1) << "Leaving Batch Mode."; 1685 DVLOG(1) << "Leaving Batch Mode.";
1668 connection_->packet_generator_.FinishBatchOperations(); 1686 connection_->packet_generator_.FinishBatchOperations();
1669 } 1687 }
1670 DCHECK_EQ(already_in_batch_mode_, 1688 DCHECK_EQ(already_in_batch_mode_,
1671 connection_->packet_generator_.InBatchMode()); 1689 connection_->packet_generator_.InBatchMode());
1672 } 1690 }
1673 1691
1674 } // namespace net 1692 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/strike_register.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698