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

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

Issue 965943002: Fixing a bug in the QUIC prober where if we received a GOAWAY before (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Remove_dead_method_QuicUnackedPacketMap_RestoreInFlight_86690324
Patch Set: Created 5 years, 9 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 2015 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/test_tools/quic_test_server.h"
6
7 namespace net {
8
9 namespace tools {
10
11 namespace test {
12
13 class QuicTestDispatcher : public QuicDispatcher {
14 public:
15 QuicTestDispatcher(const QuicConfig& config,
16 const QuicCryptoServerConfig& crypto_config,
17 const QuicVersionVector& versions,
18 PacketWriterFactory* factory,
19 EpollServer* eps)
20 : QuicDispatcher(config, crypto_config, versions, factory, eps) {}
21 QuicSession* CreateQuicSession(QuicConnectionId id,
22 const IPEndPoint& server,
23 const IPEndPoint& client) override {
24 if (session_creator_ == nullptr) {
25 return QuicDispatcher::CreateQuicSession(id, server, client);
26 } else {
27 QuicConnection* connection = CreateQuicConnection(id, server, client);
28 QuicServerSession* session =
29 (session_creator_)(config(), connection, this);
30 session->InitializeSession(crypto_config());
31 return session;
32 }
33 }
34
35 void set_session_creator(
36 const QuicTestServer::SessionCreationFunction& function) {
37 session_creator_ = function;
38 }
39
40 private:
41 QuicTestServer::SessionCreationFunction session_creator_;
42 };
43
44 QuicDispatcher* QuicTestServer::CreateQuicDispatcher() {
45 return new QuicTestDispatcher(
46 config(), crypto_config(), supported_versions(),
47 new QuicDispatcher::DefaultPacketWriterFactory(), epoll_server());
48 }
49
50 void QuicTestServer::SetSessionCreator(
51 const SessionCreationFunction& function) {
52 static_cast<QuicTestDispatcher*>(dispatcher())->set_session_creator(function);
53 }
54
55 /////////////////////////// TEST SESSIONS ///////////////////////////////
56
57 ImmediateGoAwaySession::ImmediateGoAwaySession(
58 const QuicConfig& config,
59 QuicConnection* connection,
60 QuicServerSessionVisitor* visitor)
61 : QuicServerSession(config, connection, visitor) {
62 SendGoAway(QUIC_PEER_GOING_AWAY, "");
63 }
64
65 } // namespace test
66
67 } // namespace tools
68
69 } // namespace net
OLDNEW
« net/tools/quic/test_tools/quic_test_server.h ('K') | « net/tools/quic/test_tools/quic_test_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698