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

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

Issue 1905843003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. No behavior change,… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119753783
Patch Set: Rebase 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
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/crypto/crypto_handshake.h" 18 #include "net/quic/crypto/crypto_handshake.h"
19 #include "net/quic/crypto/quic_random.h" 19 #include "net/quic/crypto/quic_random.h"
20 #include "net/quic/quic_clock.h" 20 #include "net/quic/quic_clock.h"
21 #include "net/quic/quic_crypto_stream.h" 21 #include "net/quic/quic_crypto_stream.h"
22 #include "net/quic/quic_data_reader.h" 22 #include "net/quic/quic_data_reader.h"
23 #include "net/quic/quic_protocol.h" 23 #include "net/quic/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_clock.h" 26 #include "net/tools/quic/quic_epoll_clock.h"
26 #include "net/tools/quic/quic_epoll_connection_helper.h" 27 #include "net/tools/quic/quic_epoll_connection_helper.h"
27 #include "net/tools/quic/quic_in_memory_cache.h" 28 #include "net/tools/quic/quic_in_memory_cache.h"
28 #include "net/tools/quic/quic_packet_reader.h" 29 #include "net/tools/quic/quic_packet_reader.h"
29 #include "net/tools/quic/quic_socket_utils.h" 30 #include "net/tools/quic/quic_socket_utils.h"
30 31
31 #ifndef SO_RXQ_OVFL 32 #ifndef SO_RXQ_OVFL
32 #define SO_RXQ_OVFL 40 33 #define SO_RXQ_OVFL 40
33 #endif 34 #endif
34 35
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 dispatcher_->InitializeWithWriter(CreateWriter(fd_)); 138 dispatcher_->InitializeWithWriter(CreateWriter(fd_));
138 139
139 return true; 140 return true;
140 } 141 }
141 142
142 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { 143 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
143 return new QuicDefaultPacketWriter(fd); 144 return new QuicDefaultPacketWriter(fd);
144 } 145 }
145 146
146 QuicDispatcher* QuicServer::CreateQuicDispatcher() { 147 QuicDispatcher* QuicServer::CreateQuicDispatcher() {
148 QuicEpollAlarmFactory alarm_factory(&epoll_server_);
147 return new QuicDispatcher( 149 return new QuicDispatcher(
148 config_, &crypto_config_, supported_versions_, 150 config_, &crypto_config_, supported_versions_,
149 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper( 151 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper(
150 &epoll_server_, QuicAllocator::BUFFER_POOL))); 152 &epoll_server_, QuicAllocator::BUFFER_POOL)),
153 std::unique_ptr<QuicEpollAlarmFactory>(
154 new QuicEpollAlarmFactory(&epoll_server_)));
151 } 155 }
152 156
153 void QuicServer::WaitForEvents() { 157 void QuicServer::WaitForEvents() {
154 epoll_server_.WaitForEventsAndExecuteCallbacks(); 158 epoll_server_.WaitForEventsAndExecuteCallbacks();
155 } 159 }
156 160
157 void QuicServer::Shutdown() { 161 void QuicServer::Shutdown() {
158 // 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
159 // notify clients that they're closing. 163 // notify clients that they're closing.
160 dispatcher_->Shutdown(); 164 dispatcher_->Shutdown();
(...skipping 19 matching lines...) Expand all
180 dispatcher_->OnCanWrite(); 184 dispatcher_->OnCanWrite();
181 if (dispatcher_->HasPendingWrites()) { 185 if (dispatcher_->HasPendingWrites()) {
182 event->out_ready_mask |= EPOLLOUT; 186 event->out_ready_mask |= EPOLLOUT;
183 } 187 }
184 } 188 }
185 if (event->in_events & EPOLLERR) { 189 if (event->in_events & EPOLLERR) {
186 } 190 }
187 } 191 }
188 192
189 } // namespace net 193 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_epoll_connection_helper_test.cc ('k') | net/tools/quic/quic_server_session_base_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698