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

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

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.h ('k') | net/tools/quic/quic_server_session_base.h » ('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>
15
14 #include "net/base/ip_endpoint.h" 16 #include "net/base/ip_endpoint.h"
15 #include "net/base/sockaddr_storage.h" 17 #include "net/base/sockaddr_storage.h"
16 #include "net/quic/crypto/crypto_handshake.h" 18 #include "net/quic/crypto/crypto_handshake.h"
17 #include "net/quic/crypto/quic_random.h" 19 #include "net/quic/crypto/quic_random.h"
18 #include "net/quic/quic_clock.h" 20 #include "net/quic/quic_clock.h"
19 #include "net/quic/quic_crypto_stream.h" 21 #include "net/quic/quic_crypto_stream.h"
20 #include "net/quic/quic_data_reader.h" 22 #include "net/quic/quic_data_reader.h"
21 #include "net/quic/quic_protocol.h" 23 #include "net/quic/quic_protocol.h"
22 #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"
23 #include "net/tools/quic/quic_epoll_clock.h" 26 #include "net/tools/quic/quic_epoll_clock.h"
24 #include "net/tools/quic/quic_epoll_connection_helper.h" 27 #include "net/tools/quic/quic_epoll_connection_helper.h"
25 #include "net/tools/quic/quic_in_memory_cache.h" 28 #include "net/tools/quic/quic_in_memory_cache.h"
26 #include "net/tools/quic/quic_packet_reader.h" 29 #include "net/tools/quic/quic_packet_reader.h"
27 #include "net/tools/quic/quic_socket_utils.h" 30 #include "net/tools/quic/quic_socket_utils.h"
28 31
29 #ifndef SO_RXQ_OVFL 32 #ifndef SO_RXQ_OVFL
30 #define SO_RXQ_OVFL 40 33 #define SO_RXQ_OVFL 40
31 #endif 34 #endif
32 35
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 dispatcher_->InitializeWithWriter(CreateWriter(fd_)); 138 dispatcher_->InitializeWithWriter(CreateWriter(fd_));
136 139
137 return true; 140 return true;
138 } 141 }
139 142
140 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { 143 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
141 return new QuicDefaultPacketWriter(fd); 144 return new QuicDefaultPacketWriter(fd);
142 } 145 }
143 146
144 QuicDispatcher* QuicServer::CreateQuicDispatcher() { 147 QuicDispatcher* QuicServer::CreateQuicDispatcher() {
145 return new QuicDispatcher(config_, &crypto_config_, supported_versions_, 148 QuicEpollAlarmFactory alarm_factory(&epoll_server_);
146 new QuicEpollConnectionHelper( 149 return new QuicDispatcher(
147 &epoll_server_, QuicAllocator::BUFFER_POOL)); 150 config_, &crypto_config_, supported_versions_,
151 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper(
152 &epoll_server_, QuicAllocator::BUFFER_POOL)),
153 std::unique_ptr<QuicEpollAlarmFactory>(
154 new QuicEpollAlarmFactory(&epoll_server_)));
148 } 155 }
149 156
150 void QuicServer::WaitForEvents() { 157 void QuicServer::WaitForEvents() {
151 epoll_server_.WaitForEventsAndExecuteCallbacks(); 158 epoll_server_.WaitForEventsAndExecuteCallbacks();
152 } 159 }
153 160
154 void QuicServer::Shutdown() { 161 void QuicServer::Shutdown() {
155 // Before we shut down the epoll server, give all active sessions a chance to 162 // Before we shut down the epoll server, give all active sessions a chance to
156 // notify clients that they're closing. 163 // notify clients that they're closing.
157 dispatcher_->Shutdown(); 164 dispatcher_->Shutdown();
(...skipping 19 matching lines...) Expand all
177 dispatcher_->OnCanWrite(); 184 dispatcher_->OnCanWrite();
178 if (dispatcher_->HasPendingWrites()) { 185 if (dispatcher_->HasPendingWrites()) {
179 event->out_ready_mask |= EPOLLOUT; 186 event->out_ready_mask |= EPOLLOUT;
180 } 187 }
181 } 188 }
182 if (event->in_events & EPOLLERR) { 189 if (event->in_events & EPOLLERR) {
183 } 190 }
184 } 191 }
185 192
186 } // namespace net 193 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.h ('k') | net/tools/quic/quic_server_session_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698