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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 1381233003: Increase the datagram receive buffer on Windows to 64k (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « no previous file | tests/standalone/io/raw_datagram_socket_test.dart » ('j') | tests/standalone/io/raw_datagram_socket_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698