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 9
9
- ' .github/workflows/cupertino.yml'
10
10
- ' pkgs/cupertino_http/**'
11
11
- ' pkgs/http_client_conformance_tests/**'
12
+ - ' pkgs/web_socket_conformance_tests/**'
12
13
pull_request :
13
14
paths :
14
15
- ' .github/workflows/cupertino.yml'
15
16
- ' pkgs/cupertino_http/**'
16
17
- ' pkgs/http_client_conformance_tests/**'
18
+ - ' pkgs/web_socket_conformance_tests/**'
17
19
schedule :
18
20
- cron : " 0 0 * * 0"
19
21
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ const _webSocketGuid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
14
14
/// WebSocket upgrade.
15
15
void hybridMain (StreamChannel <Object ?> channel) async {
16
16
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 {
19
20
var key = request.headers.value ('Sec-WebSocket-Key' );
20
21
var digest = sha1.convert ('$key $_webSocketGuid ' .codeUnits);
21
22
var accept = base64.encode (digest.bytes);
@@ -28,7 +29,14 @@ void hybridMain(StreamChannel<Object?> channel) async {
28
29
final socket = await request.response.detachSocket ();
29
30
socket.write ('marry had a little lamb whose fleece was white as snow' );
30
31
});
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
+ });
32
40
channel.sink.add (server.port);
33
41
34
42
await channel
You can’t perform that action at this time.
0 commit comments