Skip to content

Commit 4b11cb2

Browse files
emeyexkevmoo
authored andcommitted
Update shelf_io.dart to support shared param (flutter#109)
Pass `shared` parameter through to `HttpServer.bind` and `HttpServer.bindSecure` (i.e., to enable port sharing across separate isolates)
1 parent 0f43831 commit 4b11cb2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.4
2+
3+
* Allow passing `shared` parameter to underlying `HttpServer.bind` calls via `shelf_io.serve`
4+
15
## 0.7.3+3
26

37
* Set max SDK version to `<3.0.0`, and adjust other dependencies.

lib/shelf_io.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ export 'src/io_server.dart';
3838
/// If a [securityContext] is provided an HTTPS server will be started.
3939
////
4040
/// See the documentation for [HttpServer.bind] and [HttpServer.bindSecure]
41-
/// for more details on [address], [port], and [backlog].
41+
/// for more details on [address], [port], [backlog], and [shared].
4242
Future<HttpServer> serve(Handler handler, address, int port,
43-
{SecurityContext securityContext, int backlog}) async {
43+
{SecurityContext securityContext, int backlog, bool shared = false}) async {
4444
backlog ??= 0;
4545
HttpServer server = await (securityContext == null
46-
? HttpServer.bind(address, port, backlog: backlog)
46+
? HttpServer.bind(address, port, backlog: backlog, shared: shared)
4747
: HttpServer.bindSecure(address, port, securityContext,
48-
backlog: backlog));
48+
backlog: backlog, shared: shared));
4949
serveRequests(server, handler);
5050
return server;
5151
}

0 commit comments

Comments
 (0)