| 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> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Specifies the directory used during QuicInMemoryCache | 40 // Specifies the directory used during QuicInMemoryCache |
| 41 // construction to seed the cache. Cache directory can be | 41 // construction to seed the cache. Cache directory can be |
| 42 // generated using `wget -p --save-headers <url>` | 42 // generated using `wget -p --save-headers <url>` |
| 43 std::string FLAGS_quic_in_memory_cache_dir = ""; | 43 std::string FLAGS_quic_in_memory_cache_dir = ""; |
| 44 | 44 |
| 45 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; | 45 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; |
| 46 const char kSourceAddressTokenSecret[] = "secret"; | 46 const char kSourceAddressTokenSecret[] = "secret"; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 QuicServer::QuicServer() | 50 QuicServer::QuicServer(ProofSource* proof_source) |
| 51 : port_(0), | 51 : port_(0), |
| 52 fd_(-1), | 52 fd_(-1), |
| 53 packets_dropped_(0), | 53 packets_dropped_(0), |
| 54 overflow_supported_(false), | 54 overflow_supported_(false), |
| 55 use_recvmmsg_(false), | 55 use_recvmmsg_(false), |
| 56 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), | 56 crypto_config_(kSourceAddressTokenSecret, |
| 57 QuicRandom::GetInstance(), |
| 58 proof_source), |
| 57 supported_versions_(QuicSupportedVersions()), | 59 supported_versions_(QuicSupportedVersions()), |
| 58 packet_reader_(new QuicPacketReader()) { | 60 packet_reader_(new QuicPacketReader()) { |
| 59 Initialize(); | 61 Initialize(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 QuicServer::QuicServer(const QuicConfig& config, | 64 QuicServer::QuicServer(ProofSource* proof_source, |
| 65 const QuicConfig& config, |
| 63 const QuicVersionVector& supported_versions) | 66 const QuicVersionVector& supported_versions) |
| 64 : port_(0), | 67 : port_(0), |
| 65 fd_(-1), | 68 fd_(-1), |
| 66 packets_dropped_(0), | 69 packets_dropped_(0), |
| 67 overflow_supported_(false), | 70 overflow_supported_(false), |
| 68 use_recvmmsg_(false), | 71 use_recvmmsg_(false), |
| 69 config_(config), | 72 config_(config), |
| 70 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), | 73 crypto_config_(kSourceAddressTokenSecret, |
| 74 QuicRandom::GetInstance(), |
| 75 proof_source), |
| 71 supported_versions_(supported_versions), | 76 supported_versions_(supported_versions), |
| 72 packet_reader_(new QuicPacketReader()) { | 77 packet_reader_(new QuicPacketReader()) { |
| 73 Initialize(); | 78 Initialize(); |
| 74 } | 79 } |
| 75 | 80 |
| 76 void QuicServer::Initialize() { | 81 void QuicServer::Initialize() { |
| 77 #if MMSG_MORE | 82 #if MMSG_MORE |
| 78 use_recvmmsg_ = true; | 83 use_recvmmsg_ = true; |
| 79 #endif | 84 #endif |
| 80 | 85 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (dispatcher_->HasPendingWrites()) { | 238 if (dispatcher_->HasPendingWrites()) { |
| 234 event->out_ready_mask |= EPOLLOUT; | 239 event->out_ready_mask |= EPOLLOUT; |
| 235 } | 240 } |
| 236 } | 241 } |
| 237 if (event->in_events & EPOLLERR) { | 242 if (event->in_events & EPOLLERR) { |
| 238 } | 243 } |
| 239 } | 244 } |
| 240 | 245 |
| 241 } // namespace tools | 246 } // namespace tools |
| 242 } // namespace net | 247 } // namespace net |
| OLD | NEW |