Index: net/tools/quic/quic_server.cc |
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc |
index ef3ae4f96112a10b99126a5959efc1345d9f19ed..8bc0e81e38f15a4b77741c2d97a7eed8109b4f22 100644 |
--- a/net/tools/quic/quic_server.cc |
+++ b/net/tools/quic/quic_server.cc |
@@ -21,6 +21,8 @@ |
#include "net/quic/quic_data_reader.h" |
#include "net/quic/quic_protocol.h" |
#include "net/tools/quic/quic_dispatcher.h" |
+#include "net/tools/quic/quic_epoll_clock.h" |
+#include "net/tools/quic/quic_epoll_connection_helper.h" |
#include "net/tools/quic/quic_in_memory_cache.h" |
#include "net/tools/quic/quic_packet_reader.h" |
#include "net/tools/quic/quic_socket_utils.h" |
@@ -38,9 +40,13 @@ |
namespace net { |
namespace tools { |
- |
namespace { |
+// Specifies the directory used during QuicInMemoryCache |
+// construction to seed the cache. Cache directory can be |
+// generated using `wget -p --save-headers <url>` |
+std::string FLAGS_quic_in_memory_cache_dir = ""; |
+ |
const PollBits kEpollFlags = PollBits(NET_POLLIN | NET_POLLOUT | NET_POLLET); |
const char kSourceAddressTokenSecret[] = "secret"; |
@@ -93,8 +99,11 @@ void QuicServer::Initialize() { |
} |
epoll_server_.set_timeout_in_us(50 * 1000); |
- // Initialize the in memory cache now. |
- QuicInMemoryCache::GetInstance(); |
+ |
+ if (!FLAGS_quic_in_memory_cache_dir.empty()) { |
+ QuicInMemoryCache::GetInstance()->InitializeFromDirectory( |
+ FLAGS_quic_in_memory_cache_dir); |
+ } |
QuicEpollClock clock(&epoll_server_); |
@@ -185,7 +194,7 @@ QuicDispatcher* QuicServer::CreateQuicDispatcher() { |
crypto_config_, |
supported_versions_, |
new QuicDispatcher::DefaultPacketWriterFactory(), |
- &epoll_server_); |
+ new QuicEpollConnectionHelper(&epoll_server_)); |
} |
void QuicServer::WaitForEvents() { |