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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 2803543006: Added synchronous socket implementation to dart:io. (Closed)
Patch Set: Addressed first round of comments Created 3 years, 8 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 43a686d8536e7bbcc7d23afebd0df0262843834d..2309ec80cb16ae5a9d750707fa82bef01c7e065a 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -937,8 +937,9 @@ bool ClientSocket::IssueRead() {
DWORD flags;
flags = 0;
+ OVERLAPPED* overlap_buffer = (sync ? NULL : buffer->GetCleanOverlapped());
int rc = WSARecv(socket(), buffer->GetWASBUF(), 1, NULL, &flags,
- buffer->GetCleanOverlapped(), NULL);
+ overlap_buffer, NULL);
if ((rc == NO_ERROR) || (WSAGetLastError() == WSA_IO_PENDING)) {
pending_read_ = buffer;
return true;
@@ -956,8 +957,10 @@ bool ClientSocket::IssueWrite() {
ASSERT(pending_write_ != NULL);
ASSERT(pending_write_->operation() == OverlappedBuffer::kWrite);
+ OVERLAPPED* overlap_buffer =
+ (sync ? NULL : pending_write->GetCleanOverlapped());
int rc = WSASend(socket(), pending_write_->GetWASBUF(), 1, NULL, 0,
- pending_write_->GetCleanOverlapped(), NULL);
+ overlap_buffer, NULL);
if ((rc == NO_ERROR) || (WSAGetLastError() == WSA_IO_PENDING)) {
return true;
}
@@ -970,8 +973,8 @@ bool ClientSocket::IssueWrite() {
void ClientSocket::IssueDisconnect() {
OverlappedBuffer* buffer = OverlappedBuffer::AllocateDisconnectBuffer();
- BOOL ok =
- DisconnectEx_(socket(), buffer->GetCleanOverlapped(), TF_REUSE_SOCKET, 0);
+ OVERLAPPED* overlap_buffer = (sync ? NULL : buffer->GetCleanOverlapped());
+ BOOL ok = DisconnectEx_(socket(), overlap_buffer, TF_REUSE_SOCKET, 0);
// DisconnectEx works like other OverlappedIO APIs, where we can get either an
// immediate success or delayed operation by WSA_IO_PENDING being set.
if (ok || (WSAGetLastError() != WSA_IO_PENDING)) {

Powered by Google App Engine
This is Rietveld 408576698