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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 close(fd_); | 202 close(fd_); |
203 fd_ = -1; | 203 fd_ = -1; |
204 } | 204 } |
205 | 205 |
206 void QuicServer::OnEvent(int fd, EpollEvent* event) { | 206 void QuicServer::OnEvent(int fd, EpollEvent* event) { |
207 DCHECK_EQ(fd, fd_); | 207 DCHECK_EQ(fd, fd_); |
208 event->out_ready_mask = 0; | 208 event->out_ready_mask = 0; |
209 | 209 |
210 if (event->in_events & EPOLLIN) { | 210 if (event->in_events & EPOLLIN) { |
211 DVLOG(1) << "EPOLLIN"; | 211 DVLOG(1) << "EPOLLIN"; |
212 bool read = true; | 212 bool more_to_read = true; |
213 while (read) { | 213 while (more_to_read) { |
214 if (use_recvmmsg_) { | 214 if (use_recvmmsg_) { |
215 read = packet_reader_->ReadAndDispatchPackets( | 215 more_to_read = packet_reader_->ReadAndDispatchPackets( |
216 fd_, port_, dispatcher_.get(), | 216 fd_, port_, dispatcher_.get(), |
217 overflow_supported_ ? &packets_dropped_ : nullptr); | 217 overflow_supported_ ? &packets_dropped_ : nullptr); |
218 } else { | 218 } else { |
219 read = QuicPacketReader::ReadAndDispatchSinglePacket( | 219 more_to_read = QuicPacketReader::ReadAndDispatchSinglePacket( |
220 fd_, port_, dispatcher_.get(), | 220 fd_, port_, dispatcher_.get(), |
221 overflow_supported_ ? &packets_dropped_ : nullptr); | 221 overflow_supported_ ? &packets_dropped_ : nullptr); |
222 } | 222 } |
223 } | 223 } |
224 } | 224 } |
225 if (event->in_events & EPOLLOUT) { | 225 if (event->in_events & EPOLLOUT) { |
226 dispatcher_->OnCanWrite(); | 226 dispatcher_->OnCanWrite(); |
227 if (dispatcher_->HasPendingWrites()) { | 227 if (dispatcher_->HasPendingWrites()) { |
228 event->out_ready_mask |= EPOLLOUT; | 228 event->out_ready_mask |= EPOLLOUT; |
229 } | 229 } |
230 } | 230 } |
231 if (event->in_events & EPOLLERR) { | 231 if (event->in_events & EPOLLERR) { |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 } // namespace tools | 235 } // namespace tools |
236 } // namespace net | 236 } // namespace net |
OLD | NEW |