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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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_session_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>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 } 198 }
199 if (event->in_events & EPOLLERR) { 199 if (event->in_events & EPOLLERR) {
200 } 200 }
201 } 201 }
202 202
203 /* static */ 203 /* static */
204 bool QuicServer::ReadAndDispatchSinglePacket(int fd, 204 bool QuicServer::ReadAndDispatchSinglePacket(int fd,
205 int port, 205 int port,
206 ProcessPacketInterface* processor, 206 ProcessPacketInterface* processor,
207 uint32* packets_dropped) { 207 QuicPacketCount* packets_dropped) {
208 // Allocate some extra space so we can send an error if the client goes over 208 // Allocate some extra space so we can send an error if the client goes over
209 // the limit. 209 // the limit.
210 char buf[2 * kMaxPacketSize]; 210 char buf[2 * kMaxPacketSize];
211 211
212 IPEndPoint client_address; 212 IPEndPoint client_address;
213 IPAddressNumber server_ip; 213 IPAddressNumber server_ip;
214 int bytes_read = 214 int bytes_read =
215 QuicSocketUtils::ReadPacket(fd, buf, arraysize(buf), 215 QuicSocketUtils::ReadPacket(fd, buf, arraysize(buf),
216 packets_dropped, 216 packets_dropped,
217 &server_ip, &client_address); 217 &server_ip, &client_address);
218 218
219 if (bytes_read < 0) { 219 if (bytes_read < 0) {
220 return false; // We failed to read. 220 return false; // We failed to read.
221 } 221 }
222 222
223 QuicEncryptedPacket packet(buf, bytes_read, false); 223 QuicEncryptedPacket packet(buf, bytes_read, false);
224 224
225 IPEndPoint server_address(server_ip, port); 225 IPEndPoint server_address(server_ip, port);
226 processor->ProcessPacket(server_address, client_address, packet); 226 processor->ProcessPacket(server_address, client_address, packet);
227 227
228 return true; 228 return true;
229 } 229 }
230 230
231 } // namespace tools 231 } // namespace tools
232 } // namespace net 232 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698