OLD | NEW |
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 Loading... |
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 Loading... |
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) |
OLD | NEW |