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

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

Issue 2322233004: Landing Recent QUIC changes until Sun Sep 4 03:41:00 (Closed)
Patch Set: Remove simulation files from the build. Created 4 years, 3 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
« no previous file with comments | « net/tools/quic/quic_per_connection_packet_writer.h ('k') | net/tools/quic/quic_server_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/quic_server.h" 5 #include "net/tools/quic/quic_server.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <features.h> 8 #include <features.h>
9 #include <netinet/in.h> 9 #include <netinet/in.h>
10 #include <string.h> 10 #include <string.h>
11 #include <sys/epoll.h> 11 #include <sys/epoll.h>
12 #include <sys/socket.h> 12 #include <sys/socket.h>
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "net/base/ip_endpoint.h" 16 #include "net/base/ip_endpoint.h"
17 #include "net/base/sockaddr_storage.h" 17 #include "net/base/sockaddr_storage.h"
18 #include "net/quic/core/crypto/crypto_handshake.h" 18 #include "net/quic/core/crypto/crypto_handshake.h"
19 #include "net/quic/core/crypto/quic_random.h" 19 #include "net/quic/core/crypto/quic_random.h"
20 #include "net/quic/core/quic_clock.h" 20 #include "net/quic/core/quic_clock.h"
21 #include "net/quic/core/quic_crypto_stream.h" 21 #include "net/quic/core/quic_crypto_stream.h"
22 #include "net/quic/core/quic_data_reader.h" 22 #include "net/quic/core/quic_data_reader.h"
23 #include "net/quic/core/quic_protocol.h" 23 #include "net/quic/core/quic_protocol.h"
24 #include "net/tools/quic/quic_dispatcher.h" 24 #include "net/tools/quic/quic_dispatcher.h"
25 #include "net/tools/quic/quic_epoll_alarm_factory.h" 25 #include "net/tools/quic/quic_epoll_alarm_factory.h"
26 #include "net/tools/quic/quic_epoll_clock.h" 26 #include "net/tools/quic/quic_epoll_clock.h"
27 #include "net/tools/quic/quic_epoll_connection_helper.h" 27 #include "net/tools/quic/quic_epoll_connection_helper.h"
28 #include "net/tools/quic/quic_in_memory_cache.h" 28 #include "net/tools/quic/quic_in_memory_cache.h"
29 #include "net/tools/quic/quic_packet_reader.h" 29 #include "net/tools/quic/quic_packet_reader.h"
30 #include "net/tools/quic/quic_simple_crypto_server_stream_helper.h"
30 #include "net/tools/quic/quic_simple_dispatcher.h" 31 #include "net/tools/quic/quic_simple_dispatcher.h"
31 #include "net/tools/quic/quic_simple_server_session_helper.h"
32 #include "net/tools/quic/quic_socket_utils.h" 32 #include "net/tools/quic/quic_socket_utils.h"
33 33
34 #ifndef SO_RXQ_OVFL 34 #ifndef SO_RXQ_OVFL
35 #define SO_RXQ_OVFL 40 35 #define SO_RXQ_OVFL 40
36 #endif 36 #endif
37 37
38 namespace net { 38 namespace net {
39 namespace { 39 namespace {
40 40
41 // Specifies the directory used during QuicInMemoryCache 41 // Specifies the directory used during QuicInMemoryCache
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { 147 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
148 return new QuicDefaultPacketWriter(fd); 148 return new QuicDefaultPacketWriter(fd);
149 } 149 }
150 150
151 QuicDispatcher* QuicServer::CreateQuicDispatcher() { 151 QuicDispatcher* QuicServer::CreateQuicDispatcher() {
152 QuicEpollAlarmFactory alarm_factory(&epoll_server_); 152 QuicEpollAlarmFactory alarm_factory(&epoll_server_);
153 return new QuicSimpleDispatcher( 153 return new QuicSimpleDispatcher(
154 config_, &crypto_config_, &version_manager_, 154 config_, &crypto_config_, &version_manager_,
155 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper( 155 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper(
156 &epoll_server_, QuicAllocator::BUFFER_POOL)), 156 &epoll_server_, QuicAllocator::BUFFER_POOL)),
157 std::unique_ptr<QuicServerSessionBase::Helper>( 157 std::unique_ptr<QuicCryptoServerStream::Helper>(
158 new QuicSimpleServerSessionHelper(QuicRandom::GetInstance())), 158 new QuicSimpleCryptoServerStreamHelper(QuicRandom::GetInstance())),
159 std::unique_ptr<QuicEpollAlarmFactory>( 159 std::unique_ptr<QuicEpollAlarmFactory>(
160 new QuicEpollAlarmFactory(&epoll_server_))); 160 new QuicEpollAlarmFactory(&epoll_server_)));
161 } 161 }
162 162
163 void QuicServer::WaitForEvents() { 163 void QuicServer::WaitForEvents() {
164 epoll_server_.WaitForEventsAndExecuteCallbacks(); 164 epoll_server_.WaitForEventsAndExecuteCallbacks();
165 } 165 }
166 166
167 void QuicServer::Shutdown() { 167 void QuicServer::Shutdown() {
168 // Before we shut down the epoll server, give all active sessions a chance to 168 // Before we shut down the epoll server, give all active sessions a chance to
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 dispatcher_->OnCanWrite(); 203 dispatcher_->OnCanWrite();
204 if (dispatcher_->HasPendingWrites()) { 204 if (dispatcher_->HasPendingWrites()) {
205 event->out_ready_mask |= EPOLLOUT; 205 event->out_ready_mask |= EPOLLOUT;
206 } 206 }
207 } 207 }
208 if (event->in_events & EPOLLERR) { 208 if (event->in_events & EPOLLERR) {
209 } 209 }
210 } 210 }
211 211
212 } // namespace net 212 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_per_connection_packet_writer.h ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698