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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 epoll_server_.set_timeout_in_us(50 * 1000); | 87 epoll_server_.set_timeout_in_us(50 * 1000); |
88 | 88 |
89 if (!FLAGS_quic_in_memory_cache_dir.empty()) { | 89 if (!FLAGS_quic_in_memory_cache_dir.empty()) { |
90 QuicInMemoryCache::GetInstance()->InitializeFromDirectory( | 90 QuicInMemoryCache::GetInstance()->InitializeFromDirectory( |
91 FLAGS_quic_in_memory_cache_dir); | 91 FLAGS_quic_in_memory_cache_dir); |
92 } | 92 } |
93 | 93 |
94 QuicEpollClock clock(&epoll_server_); | 94 QuicEpollClock clock(&epoll_server_); |
95 | 95 |
96 scoped_ptr<CryptoHandshakeMessage> scfg(crypto_config_.AddDefaultConfig( | 96 std::unique_ptr<CryptoHandshakeMessage> scfg(crypto_config_.AddDefaultConfig( |
97 QuicRandom::GetInstance(), &clock, crypto_config_options_)); | 97 QuicRandom::GetInstance(), &clock, crypto_config_options_)); |
98 } | 98 } |
99 | 99 |
100 QuicServer::~QuicServer() {} | 100 QuicServer::~QuicServer() {} |
101 | 101 |
102 bool QuicServer::CreateUDPSocketAndListen(const IPEndPoint& address) { | 102 bool QuicServer::CreateUDPSocketAndListen(const IPEndPoint& address) { |
103 fd_ = QuicSocketUtils::CreateUDPSocket(address, &overflow_supported_); | 103 fd_ = QuicSocketUtils::CreateUDPSocket(address, &overflow_supported_); |
104 if (fd_ < 0) { | 104 if (fd_ < 0) { |
105 LOG(ERROR) << "CreateSocket() failed: " << strerror(errno); | 105 LOG(ERROR) << "CreateSocket() failed: " << strerror(errno); |
106 return false; | 106 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 dispatcher_->OnCanWrite(); | 177 dispatcher_->OnCanWrite(); |
178 if (dispatcher_->HasPendingWrites()) { | 178 if (dispatcher_->HasPendingWrites()) { |
179 event->out_ready_mask |= EPOLLOUT; | 179 event->out_ready_mask |= EPOLLOUT; |
180 } | 180 } |
181 } | 181 } |
182 if (event->in_events & EPOLLERR) { | 182 if (event->in_events & EPOLLERR) { |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 } // namespace net | 186 } // namespace net |
OLD | NEW |