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

Side by Side Diff: net/tools/quic/test_tools/quic_test_server.cc

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/tools/quic/test_tools/quic_test_server.h" 5 #include "net/tools/quic/test_tools/quic_test_server.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 QuicConnectionHelperInterface* helper) 56 QuicConnectionHelperInterface* helper)
57 : QuicDispatcher(config, crypto_config, versions, factory, helper) {} 57 : QuicDispatcher(config, crypto_config, versions, factory, helper) {}
58 QuicServerSession* CreateQuicSession(QuicConnectionId id, 58 QuicServerSession* CreateQuicSession(QuicConnectionId id,
59 const IPEndPoint& client) override { 59 const IPEndPoint& client) override {
60 if (session_creator_ == nullptr && stream_creator_ == nullptr) { 60 if (session_creator_ == nullptr && stream_creator_ == nullptr) {
61 return QuicDispatcher::CreateQuicSession(id, client); 61 return QuicDispatcher::CreateQuicSession(id, client);
62 } 62 }
63 QuicConnection* connection = 63 QuicConnection* connection =
64 new QuicConnection(id, client, helper(), connection_writer_factory(), 64 new QuicConnection(id, client, helper(), connection_writer_factory(),
65 /* owns_writer= */ true, Perspective::IS_SERVER, 65 /* owns_writer= */ true, Perspective::IS_SERVER,
66 /* is_secure */ true, supported_versions()); 66 supported_versions());
67 67
68 QuicServerSession* session = nullptr; 68 QuicServerSession* session = nullptr;
69 if (stream_creator_ != nullptr) { 69 if (stream_creator_ != nullptr) {
70 session = new CustomStreamSession(config(), connection, this, 70 session = new CustomStreamSession(config(), connection, this,
71 crypto_config(), stream_creator_); 71 crypto_config(), stream_creator_);
72 } else { 72 } else {
73 session = session_creator_(config(), connection, this, crypto_config()); 73 session = session_creator_(config(), connection, this, crypto_config());
74 } 74 }
75 session->Initialize(); 75 session->Initialize();
76 return session; 76 return session;
(...skipping 21 matching lines...) Expand all
98 98
99 QuicTestServer::StreamCreationFunction stream_creator() { 99 QuicTestServer::StreamCreationFunction stream_creator() {
100 return stream_creator_; 100 return stream_creator_;
101 } 101 }
102 102
103 private: 103 private:
104 QuicTestServer::SessionCreationFunction session_creator_; 104 QuicTestServer::SessionCreationFunction session_creator_;
105 QuicTestServer::StreamCreationFunction stream_creator_; 105 QuicTestServer::StreamCreationFunction stream_creator_;
106 }; 106 };
107 107
108 QuicTestServer::QuicTestServer() : QuicServer() {} 108 QuicTestServer::QuicTestServer(ProofSource* proof_source)
109 : QuicServer(proof_source) {}
109 110
110 QuicTestServer::QuicTestServer(const QuicConfig& config, 111 QuicTestServer::QuicTestServer(ProofSource* proof_source,
112 const QuicConfig& config,
111 const QuicVersionVector& supported_versions) 113 const QuicVersionVector& supported_versions)
112 : QuicServer(config, supported_versions) {} 114 : QuicServer(proof_source, config, supported_versions) {}
113 115
114 QuicDispatcher* QuicTestServer::CreateQuicDispatcher() { 116 QuicDispatcher* QuicTestServer::CreateQuicDispatcher() {
115 return new QuicTestDispatcher( 117 return new QuicTestDispatcher(
116 config(), &crypto_config(), supported_versions(), 118 config(), &crypto_config(), supported_versions(),
117 new QuicDispatcher::DefaultPacketWriterFactory(), 119 new QuicDispatcher::DefaultPacketWriterFactory(),
118 new QuicEpollConnectionHelper(epoll_server())); 120 new QuicEpollConnectionHelper(epoll_server()));
119 } 121 }
120 122
121 void QuicTestServer::SetSessionCreator(SessionCreationFunction function) { 123 void QuicTestServer::SetSessionCreator(SessionCreationFunction function) {
122 static_cast<QuicTestDispatcher*>(dispatcher()) 124 static_cast<QuicTestDispatcher*>(dispatcher())
(...skipping 13 matching lines...) Expand all
136 QuicConnection* connection, 138 QuicConnection* connection,
137 QuicServerSessionVisitor* visitor, 139 QuicServerSessionVisitor* visitor,
138 const QuicCryptoServerConfig* crypto_config) 140 const QuicCryptoServerConfig* crypto_config)
139 : QuicServerSession(config, connection, visitor, crypto_config) { 141 : QuicServerSession(config, connection, visitor, crypto_config) {
140 SendGoAway(QUIC_PEER_GOING_AWAY, ""); 142 SendGoAway(QUIC_PEER_GOING_AWAY, "");
141 } 143 }
142 144
143 } // namespace test 145 } // namespace test
144 } // namespace tools 146 } // namespace tools
145 } // namespace net 147 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698