Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/src/adapter/io/io_serve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ extension RelicAppIOServeEx on RelicApp {
final int port = 8080,
final SecurityContext? securityContext,
final int backlog = 0,
final bool v6Only = false,
final bool shared = false,
final int noOfIsolates = 1,
}) {
return run(
() => IOAdapter.bind(
address ?? InternetAddress.loopbackIPv4,
port: port,
context: securityContext,
backlog: backlog,
shared: shared,
v6Only: v6Only,
shared: shared || noOfIsolates > 1,
),
noOfIsolates: noOfIsolates,
);
}
}
3 changes: 2 additions & 1 deletion lib/src/relic_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ final class _MultiIsolateRelicServer implements RelicServer {
_MultiIsolateRelicServer(
final Factory<Adapter> adapterFactory,
final int noOfIsolates,
) : _children = List.generate(
) : assert(noOfIsolates > 1),
_children = List.generate(
noOfIsolates,
(_) => _IsolatedRelicServer(adapterFactory),
);
Expand Down
2 changes: 1 addition & 1 deletion test/router/relic_app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void main() {
final called = StreamController<int>();
final app = RelicApp()..inject(_Injectable(() => called.add(++count)));

await app.serve();
await app.serve(noOfIsolates: 2);

final vmService = await vmi.vmServiceConnectUri(wsUri.toString());

Expand Down