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

Unified Diff: sdk/lib/io/socket.dart

Issue 250513002: Add support for cloning server-sockets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup. Created 6 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
« runtime/bin/socket_patch.dart ('K') | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/socket.dart
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index b1e5be77eb44703edbc16661c1da61c9bf270376..5728284d52da10befcdb554892922718ecdccfad 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -244,6 +244,37 @@ abstract class RawServerSocket implements Stream<RawSocket> {
* is fully closed and is no longer bound.
*/
Future<RawServerSocket> close();
+
+ /**
+ * Clone a [RawServerSocket].
+ *
+ * Returns a [RawServerSocketHandle] that can be sent to other isolates. To
Lasse Reichstein Nielsen 2014/04/24 12:46:47 This feels wrong. It seems there is some underlyi
Søren Gjesse 2014/04/25 12:24:44 We already discussed that the naming is difficult.
+ * listen on the cloned [RawServerSocket], first call
+ * [ServerSocketHandle.acquire] to get the actual [RawServerSocket].
+ *
+ * All cloned [RawServerSocket]s will receive incoming [Socket]s using a
+ * round-robin approach.
+ *
+ * WARNING: This feature is highly *experimental* and currently only works on
+ * Linux. The API is most likely going to change in the near future.
+ */
+ RawServerSocketHandle clone();
+}
+
+
+/**
+ * A [RawServerSocketHandle].
+ *
+ * See [RawServerSocket.clone] for more information.
+ */
+abstract class RawServerSocketHandle {
+ /**
+ * Acquire the cloned [RawServerSocket].
+ *
+ * After a call to [acquire], the [RawServerSocketHandle] object is no longer
+ * valid.
+ */
+ Future<RawServerSocket> acquire();
}
@@ -305,8 +336,40 @@ abstract class ServerSocket implements Stream<Socket> {
* is fully closed and is no longer bound.
*/
Future<ServerSocket> close();
+
+ /**
+ * Clone a [ServerSocket].
+ *
+ * Returns a [ServerSocketHandle] that can be sent to other isolates. To
+ * listen on the cloned [ServerSocket], first call
+ * [ServerSocketHandle.acquire] to get the actual [ServerSocket].
+ *
+ * All cloned [ServerSocket]s will receive incoming [Socket]s using a
+ * round-robin approach.
+ *
+ * WARNING: This feature is highly *experimental* and currently only works on
+ * Linux. The API is most likely going to change in the near future.
+ */
+ ServerSocketHandle clone();
}
+
+/**
+ * A [ServerSocketHandle].
+ *
+ * See [ServerSocket.clone] for more information.
+ */
+abstract class ServerSocketHandle {
+ /**
+ * Acquire the cloned [ServerSocket].
+ *
+ * After a call to [acquire], the [ServerSocketHandle] object is no longer
+ * valid.
+ */
+ Future<ServerSocket> acquire();
+}
+
+
/**
* The [SocketDirection] is used as a parameter to [Socket.close] and
* [RawSocket.close] to close a socket in the specified direction(s).
« runtime/bin/socket_patch.dart ('K') | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698