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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (event->in_events & EPOLLIN) { | 163 if (event->in_events & EPOLLIN) { |
164 LOG(ERROR) << "EPOLLIN"; | 164 LOG(ERROR) << "EPOLLIN"; |
165 bool read = true; | 165 bool read = true; |
166 while (read) { | 166 while (read) { |
167 read = ReadAndDispatchSinglePacket( | 167 read = ReadAndDispatchSinglePacket( |
168 fd_, port_, dispatcher_.get(), | 168 fd_, port_, dispatcher_.get(), |
169 overflow_supported_ ? &packets_dropped_ : NULL); | 169 overflow_supported_ ? &packets_dropped_ : NULL); |
170 } | 170 } |
171 } | 171 } |
172 if (event->in_events & EPOLLOUT) { | 172 if (event->in_events & EPOLLOUT) { |
173 LOG(INFO) << "Epollout"; | |
174 bool can_write_more = dispatcher_->OnCanWrite(); | 173 bool can_write_more = dispatcher_->OnCanWrite(); |
175 if (can_write_more) { | 174 if (can_write_more) { |
176 event->out_ready_mask |= EPOLLOUT; | 175 event->out_ready_mask |= EPOLLOUT; |
177 } | 176 } |
178 } | 177 } |
179 if (event->in_events & EPOLLERR) { | 178 if (event->in_events & EPOLLERR) { |
180 LOG(INFO) << "Epollerr"; | |
181 } | 179 } |
182 } | 180 } |
183 | 181 |
184 bool QuicServer::ReadAndDispatchSinglePacket(int fd, | 182 bool QuicServer::ReadAndDispatchSinglePacket(int fd, |
185 int port, | 183 int port, |
186 QuicDispatcher* dispatcher, | 184 QuicDispatcher* dispatcher, |
187 int* packets_dropped) { | 185 int* packets_dropped) { |
188 // Allocate some extra space so we can send an error if the client goes over | 186 // Allocate some extra space so we can send an error if the client goes over |
189 // the limit. | 187 // the limit. |
190 char buf[2 * kMaxPacketSize]; | 188 char buf[2 * kMaxPacketSize]; |
(...skipping 22 matching lines...) Expand all Loading... |
213 } | 211 } |
214 | 212 |
215 IPEndPoint server_address(server_ip, port); | 213 IPEndPoint server_address(server_ip, port); |
216 dispatcher->ProcessPacket(server_address, client_address, guid, packet); | 214 dispatcher->ProcessPacket(server_address, client_address, guid, packet); |
217 | 215 |
218 return true; | 216 return true; |
219 } | 217 } |
220 | 218 |
221 } // namespace tools | 219 } // namespace tools |
222 } // namespace net | 220 } // namespace net |
OLD | NEW |