Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: runtime/bin/eventhandler_linux.cc

Issue 8776001: Fix HTTP sample implementation to actually wait for connections before attempting to write. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/socket_impl.dart » ('j') | samples/chat/http_impl.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <poll.h> 6 #include <poll.h>
7 #include <pthread.h> 7 #include <pthread.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 printf("(and %08x) ", pollfd->revents & ~all_events); 208 printf("(and %08x) ", pollfd->revents & ~all_events);
209 } 209 }
210 printf("(available %d) ", FDUtils::AvailableBytes(pollfd->fd)); 210 printf("(available %d) ", FDUtils::AvailableBytes(pollfd->fd));
211 211
212 printf("\n"); 212 printf("\n");
213 } 213 }
214 #endif 214 #endif
215 215
216 intptr_t EventHandlerImplementation::GetPollEvents(struct pollfd* pollfd) { 216 intptr_t EventHandlerImplementation::GetPollEvents(struct pollfd* pollfd) {
217 #ifdef DEBUG_POLL 217 #ifdef DEBUG_POLL
218 printf("Poll events:\n");
219 if (pollfd->fd != interrupt_fds_[0]) PrintEventMask(pollfd); 218 if (pollfd->fd != interrupt_fds_[0]) PrintEventMask(pollfd);
220 #endif 219 #endif
221 intptr_t event_mask = 0; 220 intptr_t event_mask = 0;
222 SocketData* sd = GetSocketData(pollfd->fd); 221 SocketData* sd = GetSocketData(pollfd->fd);
223 if (sd->IsListeningSocket()) { 222 if (sd->IsListeningSocket()) {
224 // For listening sockets the POLLIN event indicate that there are 223 // For listening sockets the POLLIN event indicate that there are
225 // connections ready for accept unless accompanied with one of the 224 // connections ready for accept unless accompanied with one of the
226 // other flags. 225 // other flags.
227 if ((pollfd->revents & POLLIN) != 0) { 226 if ((pollfd->revents & POLLIN) != 0) {
228 if ((pollfd->revents & POLLHUP) != 0) event_mask |= (1 << kCloseEvent); 227 if ((pollfd->revents & POLLHUP) != 0) event_mask |= (1 << kCloseEvent);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 FATAL("Create start event handler thread"); 371 FATAL("Create start event handler thread");
373 } 372 }
374 } 373 }
375 374
376 375
377 void EventHandlerImplementation::SendData(intptr_t id, 376 void EventHandlerImplementation::SendData(intptr_t id,
378 Dart_Port dart_port, 377 Dart_Port dart_port,
379 intptr_t data) { 378 intptr_t data) {
380 WakeupHandler(id, dart_port, data); 379 WakeupHandler(id, dart_port, data);
381 } 380 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_impl.dart » ('j') | samples/chat/http_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698