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

Unified Diff: runtime/bin/socket_patch.dart

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_macos.cc ('k') | runtime/bin/socket_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index e697822396c1cfa1b350ed3dc47e915533ecaa98..47c819a37b5b6da6cf28ecb4069c106ea31340d2 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -392,6 +392,12 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
close();
}
+ bool setOption(SocketOption option, bool enabled) {
+ if (option is! SocketOption) throw new ArgumentError(options);
+ if (enabled is! bool) throw new ArgumentError(enabled);
+ return nativeSetOption(option._value, enabled);
+ }
+
nativeAvailable() native "Socket_Available";
nativeRead(int len) native "Socket_Read";
nativeWrite(List<int> buffer, int offset, int bytes)
@@ -403,6 +409,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
int nativeGetPort() native "Socket_GetPort";
List nativeGetRemotePeer() native "Socket_GetRemotePeer";
OSError nativeGetError() native "Socket_GetError";
+ bool nativeSetOption(int option, bool enabled) native "Socket_SetOption";
static SendPort newServicePort() native "Socket_NewServicePort";
}
@@ -571,6 +578,9 @@ class _RawSocket extends Stream<RawSocketEvent>
}
}
+ bool setOption(SocketOption option, bool enabled) =>
+ _socket.setOption(option, enabled);
+
_pause() {
_socket.setListening(read: false, write: false);
}
@@ -800,6 +810,11 @@ class _Socket extends Stream<List<int>> implements Socket {
_controller.close();
}
+ bool setOption(SocketOption option, bool enabled) {
+ if (_raw == null) return false;
+ return _raw.setOption(option, enabled);
+ }
+
int get port => _raw.port;
String get remoteHost => _raw.remoteHost;
int get remotePort => _raw.remotePort;
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698