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

Side by Side Diff: net/tools/quic/quic_simple_client_session.cc

Issue 1035533006: Unify the QUIC client classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ssize_t Created 5 years, 8 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
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/tools/quic/quic_simple_client_session.h"
6
7 #include "base/logging.h"
8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/quic/quic_server_id.h"
10 #include "net/tools/quic/quic_simple_client_stream.h"
11
12 using std::string;
13
14 namespace net {
15 namespace tools {
16
17 QuicSimpleClientSession::QuicSimpleClientSession(const QuicConfig& config,
18 QuicConnection* connection)
19 : QuicClientSessionBase(connection, config), respect_goaway_(true) {
20 }
21
22 QuicSimpleClientSession::~QuicSimpleClientSession() {
23 }
24
25 void QuicSimpleClientSession::InitializeSession(
26 const QuicServerId& server_id,
27 QuicCryptoClientConfig* crypto_config) {
28 crypto_stream_.reset(
29 new QuicCryptoClientStream(server_id, this, nullptr, crypto_config));
30 QuicClientSessionBase::InitializeSession();
31 }
32
33 void QuicSimpleClientSession::OnProofValid(
34 const QuicCryptoClientConfig::CachedState& /*cached*/) {}
35
36 void QuicSimpleClientSession::OnProofVerifyDetailsAvailable(
37 const ProofVerifyDetails& /*verify_details*/) {}
38
39 QuicSimpleClientStream* QuicSimpleClientSession::CreateOutgoingDataStream() {
40 if (!crypto_stream_->encryption_established()) {
41 DVLOG(1) << "Encryption not active so no outgoing stream created.";
42 return nullptr;
43 }
44 if (GetNumOpenStreams() >= get_max_open_streams()) {
45 DVLOG(1) << "Failed to create a new outgoing stream. "
46 << "Already " << GetNumOpenStreams() << " open.";
47 return nullptr;
48 }
49 if (goaway_received() && respect_goaway_) {
50 DVLOG(1) << "Failed to create a new outgoing stream. "
51 << "Already received goaway.";
52 return nullptr;
53 }
54 QuicSimpleClientStream* stream
55 = new QuicSimpleClientStream(GetNextStreamId(), this);
56 ActivateStream(stream);
57 return stream;
58 }
59
60 QuicCryptoClientStream* QuicSimpleClientSession::GetCryptoStream() {
61 return crypto_stream_.get();
62 }
63
64 void QuicSimpleClientSession::CryptoConnect() {
65 DCHECK(flow_controller());
66 crypto_stream_->CryptoConnect();
67 }
68
69 int QuicSimpleClientSession::GetNumSentClientHellos() const {
70 return crypto_stream_->num_sent_client_hellos();
71 }
72
73 QuicDataStream* QuicSimpleClientSession::CreateIncomingDataStream(
74 QuicStreamId id) {
75 DLOG(ERROR) << "Server push not supported";
76 return nullptr;
77 }
78
79 } // namespace tools
80 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client_session.h ('k') | net/tools/quic/quic_simple_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698