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

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

Issue 1031243002: Unify the QUIC dispatcher and make the QuicServer work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: QuicChromeServerDispatchPacketTest 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
« no previous file with comments | « net/tools/quic/quic_server.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 #ifndef __APPLE__ 8 #ifndef __APPLE__
9 // This is a GNU header that is not present in /usr/include on MacOS 9 // This is a GNU header that is not present in /usr/include on MacOS
10 #include <features.h> 10 #include <features.h>
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 !server_address.FromSockAddr(storage.addr, storage.addr_len)) { 176 !server_address.FromSockAddr(storage.addr, storage.addr_len)) {
177 LOG(ERROR) << "Unable to get self address. Error: " << strerror(errno); 177 LOG(ERROR) << "Unable to get self address. Error: " << strerror(errno);
178 return false; 178 return false;
179 } 179 }
180 port_ = server_address.port(); 180 port_ = server_address.port();
181 DVLOG(1) << "Kernel assigned port is " << port_; 181 DVLOG(1) << "Kernel assigned port is " << port_;
182 } 182 }
183 183
184 epoll_server_.RegisterFD(fd_, this, kEpollFlags); 184 epoll_server_.RegisterFD(fd_, this, kEpollFlags);
185 dispatcher_.reset(CreateQuicDispatcher()); 185 dispatcher_.reset(CreateQuicDispatcher());
186 dispatcher_->Initialize(fd_); 186 dispatcher_->InitializeWithWriter(CreateWriter(fd_));
187 187
188 return true; 188 return true;
189 } 189 }
190 190
191 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
192 return new QuicDefaultPacketWriter(fd);
193 }
194
191 QuicDispatcher* QuicServer::CreateQuicDispatcher() { 195 QuicDispatcher* QuicServer::CreateQuicDispatcher() {
192 return new QuicDispatcher( 196 return new QuicDispatcher(
193 config_, 197 config_,
194 crypto_config_, 198 crypto_config_,
195 supported_versions_, 199 supported_versions_,
196 new QuicDispatcher::DefaultPacketWriterFactory(), 200 new QuicDispatcher::DefaultPacketWriterFactory(),
197 new QuicEpollConnectionHelper(&epoll_server_)); 201 new QuicEpollConnectionHelper(&epoll_server_));
198 } 202 }
199 203
200 void QuicServer::WaitForEvents() { 204 void QuicServer::WaitForEvents() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 QuicEncryptedPacket packet(buf, bytes_read, false); 285 QuicEncryptedPacket packet(buf, bytes_read, false);
282 286
283 IPEndPoint server_address(server_ip, port); 287 IPEndPoint server_address(server_ip, port);
284 processor->ProcessPacket(server_address, client_address, packet); 288 processor->ProcessPacket(server_address, client_address, packet);
285 289
286 return true; 290 return true;
287 } 291 }
288 292
289 } // namespace tools 293 } // namespace tools
290 } // namespace net 294 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698