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

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

Issue 172363002: Fix Windows event-handler, where write can 'complete' with 0 bytes written. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months 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 | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/eventhandler.h" 8 #include "bin/eventhandler.h"
9 9
10 #include <winsock2.h> // NOLINT 10 #include <winsock2.h> // NOLINT
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1114
1115 DeleteIfClosed(handle); 1115 DeleteIfClosed(handle);
1116 } 1116 }
1117 1117
1118 1118
1119 void EventHandlerImplementation::HandleWrite(Handle* handle, 1119 void EventHandlerImplementation::HandleWrite(Handle* handle,
1120 int bytes, 1120 int bytes,
1121 OverlappedBuffer* buffer) { 1121 OverlappedBuffer* buffer) {
1122 handle->WriteComplete(buffer); 1122 handle->WriteComplete(buffer);
1123 1123
1124 if (bytes > 0) { 1124 if (bytes >= 0) {
1125 if (!handle->IsError() && !handle->IsClosing()) { 1125 if (!handle->IsError() && !handle->IsClosing()) {
1126 int event_mask = 1 << kOutEvent; 1126 int event_mask = 1 << kOutEvent;
1127 if ((handle->mask() & event_mask) != 0) { 1127 if ((handle->mask() & event_mask) != 0) {
1128 DartUtils::PostInt32(handle->port(), event_mask); 1128 DartUtils::PostInt32(handle->port(), event_mask);
1129 } 1129 }
1130 } 1130 }
1131 } else if (bytes == 0) {
1132 HandleClosed(handle);
1133 } else { 1131 } else {
1134 HandleError(handle); 1132 HandleError(handle);
1135 } 1133 }
1136 1134
1137 DeleteIfClosed(handle); 1135 DeleteIfClosed(handle);
1138 } 1136 }
1139 1137
1140 1138
1141 void EventHandlerImplementation::HandleDisconnect( 1139 void EventHandlerImplementation::HandleDisconnect(
1142 ClientSocket* client_socket, 1140 ClientSocket* client_socket,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 1299
1302 1300
1303 void EventHandlerImplementation::Shutdown() { 1301 void EventHandlerImplementation::Shutdown() {
1304 SendData(kShutdownId, 0, 0); 1302 SendData(kShutdownId, 0, 0);
1305 } 1303 }
1306 1304
1307 } // namespace bin 1305 } // namespace bin
1308 } // namespace dart 1306 } // namespace dart
1309 1307
1310 #endif // defined(TARGET_OS_WINDOWS) 1308 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698