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

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

Issue 11367082: Add QuicStream and friends to QUIC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_stream.h ('k') | net/quic/quic_crypto_stream_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/quic/quic_crypto_stream.h"
6 #include "net/quic/quic_session.h"
7
8 using base::StringPiece;
9
10 namespace net {
11
12 QuicCryptoStream::QuicCryptoStream(QuicSession* session)
13 : ReliableQuicStream(kCryptoStreamId, session),
14 handshake_complete_(false) {
15 crypto_framer_.set_visitor(this);
16 }
17
18 void QuicCryptoStream::OnError(CryptoFramer* framer) {
19 session()->ConnectionClose(framer->error(), false);
20 }
21
22 uint32 QuicCryptoStream::ProcessData(const char* data,
23 uint32 data_len) {
24 // Do not process handshake messages after the handshake is complete.
25 if (handshake_complete()) {
26 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
27 return 0;
28 }
29 if (!crypto_framer_.ProcessInput(StringPiece(data, data_len))) {
30 CloseConnection(crypto_framer_.error());
31 return 0;
32 }
33 return data_len;
34 }
35
36 void QuicCryptoStream::CloseConnection(QuicErrorCode error) {
37 session()->connection()->SendConnectionClose(error);
38 }
39
40 void QuicCryptoStream::SendHandshakeMessage(
41 const CryptoHandshakeMessage& message) {
42 scoped_ptr<QuicData> data(crypto_framer_.ConstructHandshakeMessage(message));
43 WriteData(string(data->data(), data->length()), false);
44 }
45
46 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_stream.h ('k') | net/quic/quic_crypto_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698