File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
pkgs/web_socket_conformance_tests/lib/src Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 99 - ' .github/workflows/cupertino.yml'
1010 - ' pkgs/cupertino_http/**'
1111 - ' pkgs/http_client_conformance_tests/**'
12+ - ' pkgs/web_socket_conformance_tests/**'
1213 pull_request :
1314 paths :
1415 - ' .github/workflows/cupertino.yml'
1516 - ' pkgs/cupertino_http/**'
1617 - ' pkgs/http_client_conformance_tests/**'
18+ - ' pkgs/web_socket_conformance_tests/**'
1719 schedule :
1820 - cron : " 0 0 * * 0"
1921
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ const _webSocketGuid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
1414/// WebSocket upgrade.
1515void hybridMain (StreamChannel <Object ?> channel) async {
1616 late final HttpServer server;
17- server = (await HttpServer .bind ('localhost' , 0 ))
18- ..listen ((request) async {
17+ server = await HttpServer .bind ('localhost' , 0 );
18+ runZonedGuarded (() {
19+ server.listen ((request) async {
1920 var key = request.headers.value ('Sec-WebSocket-Key' );
2021 var digest = sha1.convert ('$key $_webSocketGuid ' .codeUnits);
2122 var accept = base64.encode (digest.bytes);
@@ -28,7 +29,14 @@ void hybridMain(StreamChannel<Object?> channel) async {
2829 final socket = await request.response.detachSocket ();
2930 socket.write ('marry had a little lamb whose fleece was white as snow' );
3031 });
31-
32+ }, (e, s) {
33+ // dart:io sometimes asynchronously throws a `SocketException` with
34+ // `errorCode` 54.
35+ // See https://github.com/dart-lang/http/pull/1786 for a full traceback.
36+ if (e is ! SocketException || e.osError? .errorCode != 54 ) {
37+ throw e as Exception ;
38+ }
39+ });
3240 channel.sink.add (server.port);
3341
3442 await channel
You can’t perform that action at this time.
0 commit comments