| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 dispatcher_->InitializeWithWriter(CreateWriter(fd_)); | 137 dispatcher_->InitializeWithWriter(CreateWriter(fd_)); |
| 138 | 138 |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { | 142 QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { |
| 143 return new QuicDefaultPacketWriter(fd); | 143 return new QuicDefaultPacketWriter(fd); |
| 144 } | 144 } |
| 145 | 145 |
| 146 QuicDispatcher* QuicServer::CreateQuicDispatcher() { | 146 QuicDispatcher* QuicServer::CreateQuicDispatcher() { |
| 147 return new QuicDispatcher(config_, &crypto_config_, supported_versions_, | 147 return new QuicDispatcher( |
| 148 new QuicEpollConnectionHelper( | 148 config_, &crypto_config_, supported_versions_, |
| 149 &epoll_server_, QuicAllocator::BUFFER_POOL)); | 149 std::unique_ptr<QuicEpollConnectionHelper>(new QuicEpollConnectionHelper( |
| 150 &epoll_server_, QuicAllocator::BUFFER_POOL))); |
| 150 } | 151 } |
| 151 | 152 |
| 152 void QuicServer::WaitForEvents() { | 153 void QuicServer::WaitForEvents() { |
| 153 epoll_server_.WaitForEventsAndExecuteCallbacks(); | 154 epoll_server_.WaitForEventsAndExecuteCallbacks(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void QuicServer::Shutdown() { | 157 void QuicServer::Shutdown() { |
| 157 // Before we shut down the epoll server, give all active sessions a chance to | 158 // Before we shut down the epoll server, give all active sessions a chance to |
| 158 // notify clients that they're closing. | 159 // notify clients that they're closing. |
| 159 dispatcher_->Shutdown(); | 160 dispatcher_->Shutdown(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 179 dispatcher_->OnCanWrite(); | 180 dispatcher_->OnCanWrite(); |
| 180 if (dispatcher_->HasPendingWrites()) { | 181 if (dispatcher_->HasPendingWrites()) { |
| 181 event->out_ready_mask |= EPOLLOUT; | 182 event->out_ready_mask |= EPOLLOUT; |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 if (event->in_events & EPOLLERR) { | 185 if (event->in_events & EPOLLERR) { |
| 185 } | 186 } |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace net | 189 } // namespace net |
| OLD | NEW |