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_session.h" | 5 #include "net/quic/core/quic_session.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/quic/core/crypto/proof_verifier.h" | 10 #include "net/quic/core/crypto/proof_verifier.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 const QuicReceivedPacket& packet) { | 276 const QuicReceivedPacket& packet) { |
277 connection_->ProcessUdpPacket(self_address, peer_address, packet); | 277 connection_->ProcessUdpPacket(self_address, peer_address, packet); |
278 } | 278 } |
279 | 279 |
280 QuicConsumedData QuicSession::WritevData( | 280 QuicConsumedData QuicSession::WritevData( |
281 QuicStream* stream, | 281 QuicStream* stream, |
282 QuicStreamId id, | 282 QuicStreamId id, |
283 QuicIOVector iov, | 283 QuicIOVector iov, |
284 QuicStreamOffset offset, | 284 QuicStreamOffset offset, |
285 bool fin, | 285 bool fin, |
286 QuicAckListenerInterface* ack_notifier_delegate) { | 286 const scoped_refptr<QuicAckListenerInterface>& ack_notifier_delegate) { |
287 // This check is an attempt to deal with potential memory corruption | 287 // This check is an attempt to deal with potential memory corruption |
288 // in which |id| ends up set to 1 (the crypto stream id). If this happen | 288 // in which |id| ends up set to 1 (the crypto stream id). If this happen |
289 // it might end up resulting in unencrypted stream data being sent. | 289 // it might end up resulting in unencrypted stream data being sent. |
290 // While this is impossible to avoid given sufficient corruption, this | 290 // While this is impossible to avoid given sufficient corruption, this |
291 // seems like a reasonable mitigation. | 291 // seems like a reasonable mitigation. |
292 if (id == kCryptoStreamId && stream != GetCryptoStream()) { | 292 if (id == kCryptoStreamId && stream != GetCryptoStream()) { |
293 QUIC_BUG << "Stream id mismatch"; | 293 QUIC_BUG << "Stream id mismatch"; |
294 connection_->CloseConnection( | 294 connection_->CloseConnection( |
295 QUIC_INTERNAL_ERROR, | 295 QUIC_INTERNAL_ERROR, |
296 "Non-crypto stream attempted to write data as crypto stream.", | 296 "Non-crypto stream attempted to write data as crypto stream.", |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 859 |
860 size_t QuicSession::MaxAvailableStreams() const { | 860 size_t QuicSession::MaxAvailableStreams() const { |
861 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 861 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
862 } | 862 } |
863 | 863 |
864 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 864 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
865 return id % 2 != next_outgoing_stream_id_ % 2; | 865 return id % 2 != next_outgoing_stream_id_ % 2; |
866 } | 866 } |
867 | 867 |
868 } // namespace net | 868 } // namespace net |
OLD | NEW |