Skip to content

Commit

Permalink
Switch to telling SseHandler to shutdown instead of closing each conn…
Browse files Browse the repository at this point in the history
…ection

This allows bypassing the keep-alive period and fixes dart-lang#950.
  • Loading branch information
DanTup committed Apr 24, 2020
1 parent 29a7e9a commit ea7b50d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dwds/debug_extension/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
js: ^0.6.1+1
pedantic: ^1.5.0
pub_semver: ^1.3.2
sse: ^3.2.0
sse: ^3.5.0

dev_dependencies:
webdev: ^2.0.0
Expand Down
6 changes: 1 addition & 5 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ class DevHandler {

Future<void> close() => _closed ??= () async {
await _sub.cancel();
// We listen for connections to close and remove them from the connections
// set. Therefore we shouldn't asynchronously iterate through the
// connections.
await Future.wait(_injectedConnections
.map((injectedConnection) => injectedConnection.sink.close()));
_sseHandler.shutdown();
await Future.wait(_servicesByAppId.values.map((service) async {
await service.close();
}));
Expand Down
2 changes: 1 addition & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies:
shelf_static: ^0.2.8
shelf_web_socket: ^0.2.0
source_maps: ^0.10.0
sse: ^3.2.0
sse: ^3.5.0
vm_service: 4.0.0
web_socket_channel: ^1.0.0
webkit_inspection_protocol: '>=0.5.0+1 <0.6.0'
Expand Down
3 changes: 3 additions & 0 deletions dwds/test/fixtures/fakes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class FakeSseConnection implements SseConnection {
StreamChannel<String> transformStream(
StreamTransformer<String, String> transformer) =>
null;

@override
void shutdown() {}
}

class FakeWebkitDebugger implements WebkitDebugger {
Expand Down
2 changes: 1 addition & 1 deletion webdev/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
shelf: ^0.7.4
shelf_proxy: ^0.1.0+5
shelf_static: ^0.2.8
sse: ^3.2.0
sse: ^3.5.0
vm_service: '>=3.0.0 <5.0.0'
webkit_inspection_protocol: '>=0.4.0 <0.6.0'
yaml: ^2.1.13
Expand Down

0 comments on commit ea7b50d

Please sign in to comment.