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

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

Issue 1983183002: Landing Recent QUIC changes until 5/14/2016 02:25:25 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "first try to fix link error for win_clang build" Created 4 years, 7 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
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_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_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/quic/crypto/proof_verifier.h" 10 #include "net/quic/crypto/proof_verifier.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 locally_closed_streams_highest_offset_.size()) > 0; 232 locally_closed_streams_highest_offset_.size()) > 0;
233 } 233 }
234 234
235 void QuicSession::ProcessUdpPacket(const IPEndPoint& self_address, 235 void QuicSession::ProcessUdpPacket(const IPEndPoint& self_address,
236 const IPEndPoint& peer_address, 236 const IPEndPoint& peer_address,
237 const QuicReceivedPacket& packet) { 237 const QuicReceivedPacket& packet) {
238 connection_->ProcessUdpPacket(self_address, peer_address, packet); 238 connection_->ProcessUdpPacket(self_address, peer_address, packet);
239 } 239 }
240 240
241 QuicConsumedData QuicSession::WritevData( 241 QuicConsumedData QuicSession::WritevData(
242 ReliableQuicStream* stream,
242 QuicStreamId id, 243 QuicStreamId id,
243 QuicIOVector iov, 244 QuicIOVector iov,
244 QuicStreamOffset offset, 245 QuicStreamOffset offset,
245 bool fin, 246 bool fin,
246 QuicAckListenerInterface* ack_notifier_delegate) { 247 QuicAckListenerInterface* ack_notifier_delegate) {
248 // This check is an attempt to deal with potential memory corruption
249 // in which |id| ends up set to 1 (the crypto stream id). If this happen
250 // it might end up resulting in unencrypted stream data being sent.
251 // While this is impossible to avoid given sufficient corruption, this
252 // seems like a reasonable mitigation.
253 if (id == kCryptoStreamId && stream != GetCryptoStream()) {
254 QUIC_BUG << "Stream id mismatch";
255 connection_->CloseConnection(
256 QUIC_INTERNAL_ERROR,
257 "Non-crypto stream attempted to write data as crypto stream.",
258 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
259 return QuicConsumedData(0, false);
260 }
247 if (!IsEncryptionEstablished() && id != kCryptoStreamId) { 261 if (!IsEncryptionEstablished() && id != kCryptoStreamId) {
248 // Do not let streams write without encryption. The calling stream will end 262 // Do not let streams write without encryption. The calling stream will end
249 // up write blocked until OnCanWrite is next called. 263 // up write blocked until OnCanWrite is next called.
250 return QuicConsumedData(0, false); 264 return QuicConsumedData(0, false);
251 } 265 }
252 QuicConsumedData data = 266 QuicConsumedData data =
253 connection_->SendStreamData(id, iov, offset, fin, ack_notifier_delegate); 267 connection_->SendStreamData(id, iov, offset, fin, ack_notifier_delegate);
254 write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed); 268 write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed);
255 return data; 269 return data;
256 } 270 }
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 820
807 size_t QuicSession::MaxAvailableStreams() const { 821 size_t QuicSession::MaxAvailableStreams() const {
808 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; 822 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier;
809 } 823 }
810 824
811 bool QuicSession::IsIncomingStream(QuicStreamId id) const { 825 bool QuicSession::IsIncomingStream(QuicStreamId id) const {
812 return id % 2 != next_outgoing_stream_id_ % 2; 826 return id % 2 != next_outgoing_stream_id_ % 2;
813 } 827 }
814 828
815 } // namespace net 829 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698