Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Unified Diff: runtime/bin/socket_patch.dart

Issue 2205913003: Better error-message when bind fails. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add android support. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/socket_unsupported.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/socket_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698