| Index: runtime/bin/socket_patch.dart
|
| diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
|
| index 2d3ba73b3f7d2abe4aee960eae131c8b7fdc8ce1..a8b60c3e0639e56ea88cc2664fc64201015aff0b 100644
|
| --- a/runtime/bin/socket_patch.dart
|
| +++ b/runtime/bin/socket_patch.dart
|
| @@ -431,7 +431,13 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| if (result is OSError) {
|
| // Keep first error, if present.
|
| if (error == null) {
|
| - error = createError(result, "Connection failed", address, port);
|
| + int errorCode = result.errorCode;
|
| + if (errorCode != null && socket.isBindError(errorCode)) {
|
| + error = createError(result, "Bind failed", sourceAddress);
|
| + } else {
|
| + error =
|
| + createError(result, "Connection failed", address, port);
|
| + }
|
| }
|
| connectNext();
|
| } else {
|
| @@ -1075,6 +1081,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
| nativeCreateBindConnect(
|
| List<int> addr, int port, List<int> sourceAddr)
|
| native "Socket_CreateBindConnect";
|
| + bool isBindError(int errorNumber) native "Socket_IsBindError";
|
| nativeCreateBindListen(List<int> addr, int port, int backlog, bool v6Only,
|
| bool shared)
|
| native "ServerSocket_CreateBindListen";
|
|
|