OLD | NEW |
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 "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
15 #include "net/quic/congestion_control/tcp_receiver.h" | 15 #include "net/quic/congestion_control/tcp_receiver.h" |
16 #include "net/quic/crypto/crypto_handshake.h" | 16 #include "net/quic/crypto/crypto_handshake.h" |
17 #include "net/quic/crypto/quic_random.h" | 17 #include "net/quic/crypto/quic_random.h" |
18 #include "net/quic/quic_clock.h" | 18 #include "net/quic/quic_clock.h" |
19 #include "net/quic/quic_crypto_stream.h" | 19 #include "net/quic/quic_crypto_stream.h" |
20 #include "net/quic/quic_data_reader.h" | 20 #include "net/quic/quic_data_reader.h" |
21 #include "net/quic/quic_protocol.h" | 21 #include "net/quic/quic_protocol.h" |
| 22 #include "net/tools/quic/quic_dispatcher.h" |
22 #include "net/tools/quic/quic_in_memory_cache.h" | 23 #include "net/tools/quic/quic_in_memory_cache.h" |
23 #include "net/tools/quic/quic_socket_utils.h" | 24 #include "net/tools/quic/quic_socket_utils.h" |
24 | 25 |
25 #define MMSG_MORE 0 | 26 #define MMSG_MORE 0 |
26 | 27 |
27 #ifndef SO_RXQ_OVFL | 28 #ifndef SO_RXQ_OVFL |
28 #define SO_RXQ_OVFL 40 | 29 #define SO_RXQ_OVFL 40 |
29 #endif | 30 #endif |
30 | 31 |
31 namespace net { | 32 namespace net { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 dispatcher_->Initialize(fd_); | 159 dispatcher_->Initialize(fd_); |
159 | 160 |
160 return true; | 161 return true; |
161 } | 162 } |
162 | 163 |
163 QuicDispatcher* QuicServer::CreateQuicDispatcher() { | 164 QuicDispatcher* QuicServer::CreateQuicDispatcher() { |
164 return new QuicDispatcher( | 165 return new QuicDispatcher( |
165 config_, | 166 config_, |
166 crypto_config_, | 167 crypto_config_, |
167 supported_versions_, | 168 supported_versions_, |
| 169 new QuicDispatcher::DefaultPacketWriterFactory(), |
168 &epoll_server_); | 170 &epoll_server_); |
169 } | 171 } |
170 | 172 |
171 void QuicServer::WaitForEvents() { | 173 void QuicServer::WaitForEvents() { |
172 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 174 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
173 } | 175 } |
174 | 176 |
175 void QuicServer::Shutdown() { | 177 void QuicServer::Shutdown() { |
176 // Before we shut down the epoll server, give all active sessions a chance to | 178 // Before we shut down the epoll server, give all active sessions a chance to |
177 // notify clients that they're closing. | 179 // notify clients that they're closing. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 QuicEncryptedPacket packet(buf, bytes_read, false); | 229 QuicEncryptedPacket packet(buf, bytes_read, false); |
228 | 230 |
229 IPEndPoint server_address(server_ip, port); | 231 IPEndPoint server_address(server_ip, port); |
230 processor->ProcessPacket(server_address, client_address, packet); | 232 processor->ProcessPacket(server_address, client_address, packet); |
231 | 233 |
232 return true; | 234 return true; |
233 } | 235 } |
234 | 236 |
235 } // namespace tools | 237 } // namespace tools |
236 } // namespace net | 238 } // namespace net |
OLD | NEW |