mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 20:51:19 +00:00
71dd8b3d16
The test was written in a way that let GC collect (and shutdown) receiving end leading to EPIPE. Fixes https://github.com/dart-lang/sdk/issues/52654 Fixed: 52654 Change-Id: I2100fee1498e80c6af65d570179d3335310696a4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308340 Reviewed-by: Tess Strickland <sstrickl@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
31 lines
1,012 B
Dart
31 lines
1,012 B
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
//
|
|
// Tests socket exceptions.
|
|
|
|
import "dart:async";
|
|
import "dart:io";
|
|
|
|
import "package:async_helper/async_helper.dart";
|
|
import "package:expect/expect.dart";
|
|
|
|
void main() async {
|
|
asyncStart();
|
|
|
|
final server = await ServerSocket.bind("127.0.0.1", 0);
|
|
late final Socket connectedSocket;
|
|
server.listen((socket) {
|
|
// Note: must keep socket alive for the duration of the test.
|
|
// Otherwise GC might collect it and and shutdown this side of socket
|
|
// which would cause writing to abort.
|
|
connectedSocket = socket;
|
|
// Passive block data by not subscribing to socket.
|
|
}, onDone: asyncEnd);
|
|
|
|
final client = await Socket.connect("127.0.0.1", server.port);
|
|
client.listen((data) {}, onDone: server.close);
|
|
client.add(new List.filled(1024 * 1024, 0));
|
|
client.destroy();
|
|
}
|