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 #include "net/quic/core/quic_packet_creator.h" | 5 #include "net/quic/core/quic_packet_creator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 case MTU_DISCOVERY_FRAME: | 604 case MTU_DISCOVERY_FRAME: |
605 return false; | 605 return false; |
606 default: | 606 default: |
607 return true; | 607 return true; |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
611 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, | 611 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
612 bool save_retransmittable_frames) { | 612 bool save_retransmittable_frames) { |
613 DVLOG(1) << "Adding frame: " << frame; | 613 DVLOG(1) << "Adding frame: " << frame; |
614 if (FLAGS_quic_never_write_unencrypted_data && frame.type == STREAM_FRAME && | 614 if (frame.type == STREAM_FRAME && |
615 frame.stream_frame->stream_id != kCryptoStreamId && | 615 frame.stream_frame->stream_id != kCryptoStreamId && |
616 packet_.encryption_level == ENCRYPTION_NONE) { | 616 packet_.encryption_level == ENCRYPTION_NONE) { |
617 const string error_details = "Cannot send stream data without encryption."; | 617 const string error_details = "Cannot send stream data without encryption."; |
618 QUIC_BUG << error_details; | 618 QUIC_BUG << error_details; |
619 delegate_->OnUnrecoverableError( | 619 delegate_->OnUnrecoverableError( |
620 QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, error_details, | 620 QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, error_details, |
621 ConnectionCloseSource::FROM_SELF); | 621 ConnectionCloseSource::FROM_SELF); |
622 return false; | 622 return false; |
623 } | 623 } |
624 if (!FLAGS_quic_simple_packet_number_length_2) { | 624 if (!FLAGS_quic_simple_packet_number_length_2) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 if (bit_mask_ == 0) { | 718 if (bit_mask_ == 0) { |
719 bit_bucket_ = random_->RandUint64(); | 719 bit_bucket_ = random_->RandUint64(); |
720 bit_mask_ = 1; | 720 bit_mask_ = 1; |
721 } | 721 } |
722 bool result = ((bit_bucket_ & bit_mask_) != 0); | 722 bool result = ((bit_bucket_ & bit_mask_) != 0); |
723 bit_mask_ <<= 1; | 723 bit_mask_ <<= 1; |
724 return result; | 724 return result; |
725 } | 725 } |
726 | 726 |
727 } // namespace net | 727 } // namespace net |
OLD | NEW |