Chromium Code Reviews| Index: runtime/bin/eventhandler_win.cc |
| diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc |
| index 6e27f821fb2a5fe603b02d80f04af957f6212f2c..5488e4d18fdb68c3c229fe07bb0a786a4017f98e 100644 |
| --- a/runtime/bin/eventhandler_win.cc |
| +++ b/runtime/bin/eventhandler_win.cc |
| @@ -989,7 +989,8 @@ bool DatagramSocket::IssueRecvFrom() { |
| ASSERT(completion_port_ != INVALID_HANDLE_VALUE); |
| ASSERT(pending_read_ == NULL); |
| - OverlappedBuffer* buffer = OverlappedBuffer::AllocateRecvFromBuffer(1024); |
| + OverlappedBuffer* buffer = |
| + OverlappedBuffer::AllocateRecvFromBuffer(64 * 1024); |
|
kustermann
2015/10/02 15:36:58
Maybe make a constant kMaxUDPPackageLength ?
[The
Søren Gjesse
2015/10/06 07:01:42
Added a constant and mentioned the current limit i
|
| DWORD flags; |
| flags = 0; |
| @@ -1212,16 +1213,21 @@ void EventHandlerImplementation::HandleRecvFrom(Handle* handle, |
| int bytes, |
| OverlappedBuffer* buffer) { |
| ASSERT(handle->is_datagram_socket()); |
| - buffer->set_data_length(bytes); |
| - handle->ReadComplete(buffer); |
| - if (!handle->IsClosing()) { |
| - int event_mask = 1 << kInEvent; |
| - if ((handle->Mask() & event_mask) != 0) { |
| + if (bytes >= 0) { |
| + buffer->set_data_length(bytes); |
| + handle->ReadComplete(buffer); |
| + if (!handle->IsClosing()) { |
| + int event_mask = 1 << kInEvent; |
| + if ((handle->Mask() & event_mask) != 0) { |
| Dart_Port port = handle->NextNotifyDartPort(event_mask); |
| - DartUtils::PostInt32(port, event_mask); |
| + DartUtils::PostInt32(port, event_mask); |
| + } |
| } |
| + } else { |
| + HandleError(handle); |
|
kustermann
2015/10/02 15:36:58
Is there a way to test that we report the error to
Søren Gjesse
2015/10/06 07:01:42
I have not found one. I did a manual test with the
|
| } |
| + |
|
kustermann
2015/10/02 15:36:58
extra empty line
Søren Gjesse
2015/10/06 07:01:42
Removed.
|
| DeleteIfClosed(handle); |
| } |
| @@ -1413,6 +1419,11 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) { |
| last_error == ERROR_BROKEN_PIPE) { |
| ASSERT(bytes == 0); |
| handler_impl->HandleIOCompletion(bytes, key, overlapped); |
| + } else if (last_error == ERROR_MORE_DATA) { |
| + // Don't ASSERT no bytes in this case. This can happen if the receive |
| + // buffer for datagram sockets is to small to contain a full datagram, |
| + // and in this case bytes hold the bytes that was read. |
| + handler_impl->HandleIOCompletion(-1, key, overlapped); |
| } else { |
| ASSERT(bytes == 0); |
| handler_impl->HandleIOCompletion(-1, key, overlapped); |