| 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/quic_crypto_stream.h" | 5 #include "net/quic/quic_crypto_stream.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 << QuicUtils::ErrorToString(framer->error()); | 36 << QuicUtils::ErrorToString(framer->error()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void QuicCryptoStream::OnHandshakeMessage( | 39 void QuicCryptoStream::OnHandshakeMessage( |
| 40 const CryptoHandshakeMessage& message) { | 40 const CryptoHandshakeMessage& message) { |
| 41 session()->OnCryptoHandshakeMessageReceived(message); | 41 session()->OnCryptoHandshakeMessageReceived(message); |
| 42 } | 42 } |
| 43 | 43 |
| 44 uint32 QuicCryptoStream::ProcessRawData(const char* data, | 44 uint32 QuicCryptoStream::ProcessRawData(const char* data, |
| 45 uint32 data_len) { | 45 uint32 data_len) { |
| 46 // Do not process handshake messages after the handshake is confirmed. | |
| 47 if (handshake_confirmed()) { | |
| 48 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | |
| 49 return 0; | |
| 50 } | |
| 51 if (!crypto_framer_.ProcessInput(StringPiece(data, data_len))) { | 46 if (!crypto_framer_.ProcessInput(StringPiece(data, data_len))) { |
| 52 CloseConnection(crypto_framer_.error()); | 47 CloseConnection(crypto_framer_.error()); |
| 53 return 0; | 48 return 0; |
| 54 } | 49 } |
| 55 return data_len; | 50 return data_len; |
| 56 } | 51 } |
| 57 | 52 |
| 58 QuicPriority QuicCryptoStream::EffectivePriority() const { | 53 QuicPriority QuicCryptoStream::EffectivePriority() const { |
| 59 return QuicUtils::HighestPriority(); | 54 return QuicUtils::HighestPriority(); |
| 60 } | 55 } |
| 61 | 56 |
| 62 void QuicCryptoStream::SendHandshakeMessage( | 57 void QuicCryptoStream::SendHandshakeMessage( |
| 63 const CryptoHandshakeMessage& message) { | 58 const CryptoHandshakeMessage& message) { |
| 64 session()->OnCryptoHandshakeMessageSent(message); | 59 session()->OnCryptoHandshakeMessageSent(message); |
| 65 const QuicData& data = message.GetSerialized(); | 60 const QuicData& data = message.GetSerialized(); |
| 66 // TODO(wtc): check the return value. | 61 // TODO(wtc): check the return value. |
| 67 WriteOrBufferData(string(data.data(), data.length()), false, NULL); | 62 WriteOrBufferData(string(data.data(), data.length()), false, NULL); |
| 68 } | 63 } |
| 69 | 64 |
| 70 const QuicCryptoNegotiatedParameters& | 65 const QuicCryptoNegotiatedParameters& |
| 71 QuicCryptoStream::crypto_negotiated_params() const { | 66 QuicCryptoStream::crypto_negotiated_params() const { |
| 72 return crypto_negotiated_params_; | 67 return crypto_negotiated_params_; |
| 73 } | 68 } |
| 74 | 69 |
| 75 } // namespace net | 70 } // namespace net |
| OLD | NEW |