| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 fd_ = -1; | 173 fd_ = -1; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void QuicServer::OnEvent(int fd, EpollEvent* event) { | 176 void QuicServer::OnEvent(int fd, EpollEvent* event) { |
| 177 DCHECK_EQ(fd, fd_); | 177 DCHECK_EQ(fd, fd_); |
| 178 event->out_ready_mask = 0; | 178 event->out_ready_mask = 0; |
| 179 | 179 |
| 180 if (event->in_events & EPOLLIN) { | 180 if (event->in_events & EPOLLIN) { |
| 181 DVLOG(1) << "EPOLLIN"; | 181 DVLOG(1) << "EPOLLIN"; |
| 182 | 182 |
| 183 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && | 183 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop) { |
| 184 FLAGS_quic_buffer_packet_till_chlo) { | |
| 185 dispatcher_->ProcessBufferedChlos(kNumSessionsToCreatePerSocketEvent); | 184 dispatcher_->ProcessBufferedChlos(kNumSessionsToCreatePerSocketEvent); |
| 186 } | 185 } |
| 187 | 186 |
| 188 bool more_to_read = true; | 187 bool more_to_read = true; |
| 189 while (more_to_read) { | 188 while (more_to_read) { |
| 190 more_to_read = packet_reader_->ReadAndDispatchPackets( | 189 more_to_read = packet_reader_->ReadAndDispatchPackets( |
| 191 fd_, port_, QuicEpollClock(&epoll_server_), dispatcher_.get(), | 190 fd_, port_, QuicEpollClock(&epoll_server_), dispatcher_.get(), |
| 192 overflow_supported_ ? &packets_dropped_ : nullptr); | 191 overflow_supported_ ? &packets_dropped_ : nullptr); |
| 193 } | 192 } |
| 194 | 193 |
| 195 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && | 194 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && |
| 196 FLAGS_quic_buffer_packet_till_chlo && dispatcher_->HasChlosBuffered()) { | 195 dispatcher_->HasChlosBuffered()) { |
| 197 // Register EPOLLIN event to consume buffered CHLO(s). | 196 // Register EPOLLIN event to consume buffered CHLO(s). |
| 198 event->out_ready_mask |= EPOLLIN; | 197 event->out_ready_mask |= EPOLLIN; |
| 199 } | 198 } |
| 200 } | 199 } |
| 201 if (event->in_events & EPOLLOUT) { | 200 if (event->in_events & EPOLLOUT) { |
| 202 dispatcher_->OnCanWrite(); | 201 dispatcher_->OnCanWrite(); |
| 203 if (dispatcher_->HasPendingWrites()) { | 202 if (dispatcher_->HasPendingWrites()) { |
| 204 event->out_ready_mask |= EPOLLOUT; | 203 event->out_ready_mask |= EPOLLOUT; |
| 205 } | 204 } |
| 206 } | 205 } |
| 207 if (event->in_events & EPOLLERR) { | 206 if (event->in_events & EPOLLERR) { |
| 208 } | 207 } |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace net | 210 } // namespace net |
| OLD | NEW |