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

Unified Diff: runtime/bin/socket_macos.cc

Issue 12614014: Add setNoDelay method on Socket/RawSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_macos.cc
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 849e1fa3f422e4daed853938d90570b26a6577d8..b11da008c7b82dccab4105668470204d27e3dd14 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -11,6 +11,7 @@
#include <string.h> // NOLINT
#include <sys/stat.h> // NOLINT
#include <unistd.h> // NOLINT
+#include <netinet/tcp.h> // NOLINT
#include "bin/fdutils.h"
#include "bin/file.h"
@@ -272,4 +273,14 @@ bool Socket::SetBlocking(intptr_t fd) {
return FDUtils::SetBlocking(fd);
}
+
+bool Socket::SetNoDelay(intptr_t fd, bool enabled) {
+ int on = enabled ? 1 : 0;
+ return TEMP_FAILURE_RETRY(setsockopt(fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ reinterpret_cast<char *>(&on),
+ sizeof(on))) == 0;
+}
+
#endif // defined(TARGET_OS_MACOS)
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698