| 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_crypto_stream.h" | 5 #include "net/quic/core/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/core/crypto/crypto_handshake.h" | 10 #include "net/quic/core/crypto/crypto_handshake.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // No more data to read. | 62 // No more data to read. |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 StringPiece data(static_cast<char*>(iov.iov_base), iov.iov_len); | 65 StringPiece data(static_cast<char*>(iov.iov_base), iov.iov_len); |
| 66 if (!crypto_framer_.ProcessInput(data)) { | 66 if (!crypto_framer_.ProcessInput(data)) { |
| 67 CloseConnectionWithDetails(crypto_framer_.error(), | 67 CloseConnectionWithDetails(crypto_framer_.error(), |
| 68 crypto_framer_.error_detail()); | 68 crypto_framer_.error_detail()); |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 sequencer()->MarkConsumed(iov.iov_len); | 71 sequencer()->MarkConsumed(iov.iov_len); |
| 72 if (handshake_confirmed_ && crypto_framer_.InputBytesRemaining() == 0) { |
| 73 // If the handshake is complete and the current message has been fully |
| 74 // processed then no more handshake messages are likely to arrive soon |
| 75 // so release the memory in the stream sequencer. |
| 76 sequencer()->ReleaseBufferIfEmpty(); |
| 77 } |
| 72 } | 78 } |
| 73 } | 79 } |
| 74 | 80 |
| 75 void QuicCryptoStream::SendHandshakeMessage( | 81 void QuicCryptoStream::SendHandshakeMessage( |
| 76 const CryptoHandshakeMessage& message) { | 82 const CryptoHandshakeMessage& message) { |
| 77 DVLOG(1) << ENDPOINT << "Sending " << message.DebugString(); | 83 DVLOG(1) << ENDPOINT << "Sending " << message.DebugString(); |
| 78 session()->connection()->NeuterUnencryptedPackets(); | 84 session()->connection()->NeuterUnencryptedPackets(); |
| 79 session()->OnCryptoHandshakeMessageSent(message); | 85 session()->OnCryptoHandshakeMessageSent(message); |
| 80 const QuicData& data = message.GetSerialized(); | 86 const QuicData& data = message.GetSerialized(); |
| 81 WriteOrBufferData(StringPiece(data.data(), data.length()), false, nullptr); | 87 WriteOrBufferData(StringPiece(data.data(), data.length()), false, nullptr); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 105 crypto_negotiated_params_.initial_subkey_secret, "EXPORTER-Token-Binding", | 111 crypto_negotiated_params_.initial_subkey_secret, "EXPORTER-Token-Binding", |
| 106 /* context= */ "", 32, result); | 112 /* context= */ "", 32, result); |
| 107 } | 113 } |
| 108 | 114 |
| 109 const QuicCryptoNegotiatedParameters& | 115 const QuicCryptoNegotiatedParameters& |
| 110 QuicCryptoStream::crypto_negotiated_params() const { | 116 QuicCryptoStream::crypto_negotiated_params() const { |
| 111 return crypto_negotiated_params_; | 117 return crypto_negotiated_params_; |
| 112 } | 118 } |
| 113 | 119 |
| 114 } // namespace net | 120 } // namespace net |
| OLD | NEW |