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

Unified Diff: runtime/bin/socket.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.h ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index d9c20e7439305bfd0057e3b40d279b80d441678b..3a35ea2d6c02434c2f36425d1c11cddbbe185088 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -445,6 +445,33 @@ void FUNCTION_NAME(Socket_NewServicePort)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Socket_SetOption)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
+ intptr_t socket = 0;
+ bool result = false;
+ Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ Dart_Handle option_obj = Dart_GetNativeArgument(args, 1);
+ int64_t option;
+ err = Dart_IntegerToInt64(option_obj, &option);
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ Dart_Handle enabled_obj = Dart_GetNativeArgument(args, 2);
+ bool enabled;
+ err = Dart_BooleanValue(enabled_obj, &enabled);
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ switch (option) {
+ case 0: // TCP_NODELAY.
+ result = Socket::SetNoDelay(socket, enabled);
+ break;
+ default:
+ break;
+ }
+ Dart_SetReturnValue(args, Dart_NewBoolean(result));
+ Dart_ExitScope();
+}
+
+
Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
}
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698