Index: sdk/lib/io/socket.dart |
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart |
index b0ace925da5328b64820a84f8cc77ae5b874168d..337029c20f954afbf35c49055639162955c21031 100644 |
--- a/sdk/lib/io/socket.dart |
+++ b/sdk/lib/io/socket.dart |
@@ -244,6 +244,36 @@ abstract class RawServerSocket implements Stream<RawSocket> { |
* is fully closed and is no longer bound. |
*/ |
Future<RawServerSocket> close(); |
+ |
+ /** |
+ * Get the [RawServerSocketReference]. |
+ * |
+ * WARNING: This feature is *highly experimental* and currently only works on |
+ * Linux. The API is most likely going to change in the near future. |
+ * |
+ * The returned [RawServerSocketReference] can be used to create other |
+ * [RawServerSocket]s listening on the same port, |
+ * using [RawServerSocketReference.create]. |
+ * Incoming connections on the port will be distributed fairly between the |
+ * active server sockets. |
+ * The [RawServerSocketReference] can be distributed to other isolates through |
+ * a [RawSendPort]. |
+ */ |
+ RawServerSocketReference get reference; |
+} |
+ |
+ |
+/** |
+ * A [RawServerSocketReference]. |
+ * |
+ * WARNING: This class is used with [RawServerSocket.reference] which is highly |
+ * experimental. |
+ */ |
+abstract class RawServerSocketReference { |
+ /** |
+ * Create a new [RawServerSocket], from this reference. |
+ */ |
+ Future<RawServerSocket> create(); |
} |
@@ -305,8 +335,39 @@ abstract class ServerSocket implements Stream<Socket> { |
* is fully closed and is no longer bound. |
*/ |
Future<ServerSocket> close(); |
+ |
+ /** |
+ * Get the [ServerSocketReference]. |
+ * |
+ * WARNING: This feature is *highly experimental* and currently only works on |
+ * Linux. The API is most likely going to change in the near future. |
+ * |
+ * The returned [ServerSocketReference] can be used to create other |
+ * [ServerSocket]s listening on the same port, |
+ * using [ServerSocketReference.create]. |
+ * Incoming connections on the port will be distributed fairly between the |
+ * active server sockets. |
+ * The [ServerSocketReference] can be distributed to other isolates through a |
+ * [SendPort]. |
+ */ |
+ ServerSocketReference get reference; |
+} |
+ |
+ |
+/** |
+ * A [ServerSocketReference]. |
+ * |
+ * WARNING: This class is used with [ServerSocket.reference] which is highly |
+ * experimental. |
+ */ |
+abstract class ServerSocketReference { |
+ /** |
+ * Create a new [ServerSocket], from this reference. |
+ */ |
+ Future<ServerSocket> create(); |
} |
+ |
/** |
* The [SocketDirection] is used as a parameter to [Socket.close] and |
* [RawSocket.close] to close a socket in the specified direction(s). |