mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 16:44:59 +00:00
Enter a description of the change.
Merge branch 'master' into revert
Revert "Better error-message when bind fails."
This reverts commit eaeb260244
.
Review URL: https://codereview.chromium.org/2213533002 .
This commit is contained in:
parent
9a68bad6fd
commit
90a194be3c
|
@ -1,10 +1,5 @@
|
|||
## 1.19.0
|
||||
|
||||
### Core library changes
|
||||
|
||||
* `dart:io`
|
||||
* Report a better error when a bind fails because of a bad source address.
|
||||
|
||||
### Tool Changes
|
||||
|
||||
* `dartfmt` - upgraded to v0.2.9
|
||||
|
|
|
@ -121,7 +121,6 @@ namespace bin {
|
|||
V(Socket_CreateConnect, 3) \
|
||||
V(Socket_CreateBindConnect, 4) \
|
||||
V(Socket_CreateBindDatagram, 4) \
|
||||
V(Socket_IsBindError, 2) \
|
||||
V(Socket_Available, 1) \
|
||||
V(Socket_Read, 2) \
|
||||
V(Socket_RecvFrom, 1) \
|
||||
|
|
|
@ -234,12 +234,6 @@ void FUNCTION_NAME(Socket_CreateBindConnect)(Dart_NativeArguments args) {
|
|||
}
|
||||
}
|
||||
|
||||
void FUNCTION_NAME(Socket_IsBindError)(Dart_NativeArguments args) {
|
||||
intptr_t error_number =
|
||||
DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
|
||||
bool is_bind_error = Socket::IsBindError(error_number);
|
||||
Dart_SetReturnValue(args, is_bind_error ? Dart_True() : Dart_False());
|
||||
}
|
||||
|
||||
void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) {
|
||||
RawAddr addr;
|
||||
|
|
|
@ -278,9 +278,6 @@ class Socket {
|
|||
// specified as the port component of the passed RawAddr structure.
|
||||
static intptr_t CreateBindConnect(const RawAddr& addr,
|
||||
const RawAddr& source_addr);
|
||||
// Returns true if the given error-number is because the system was not able
|
||||
// to bind the socket to a specific IP.
|
||||
static bool IsBindError(intptr_t error_number);
|
||||
// Creates a datagram socket which is bound. The port to bind
|
||||
// to is specified as the port component of the RawAddr structure.
|
||||
static intptr_t CreateBindDatagram(const RawAddr& addr, bool reuseAddress);
|
||||
|
|
|
@ -101,12 +101,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
|||
}
|
||||
|
||||
|
||||
bool Socket::IsBindError(intptr_t error_number) {
|
||||
return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
|
||||
error_number == EINVAL;
|
||||
}
|
||||
|
||||
|
||||
intptr_t Socket::Available(intptr_t fd) {
|
||||
return FDUtils::AvailableBytes(fd);
|
||||
}
|
||||
|
|
|
@ -45,12 +45,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
|||
}
|
||||
|
||||
|
||||
bool Socket::IsBindError(intptr_t error_number) {
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
intptr_t Socket::Available(intptr_t fd) {
|
||||
UNIMPLEMENTED();
|
||||
return -1;
|
||||
|
|
|
@ -101,12 +101,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
|||
}
|
||||
|
||||
|
||||
bool Socket::IsBindError(intptr_t error_number) {
|
||||
return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
|
||||
error_number == EINVAL;
|
||||
}
|
||||
|
||||
|
||||
intptr_t Socket::Available(intptr_t fd) {
|
||||
return FDUtils::AvailableBytes(fd);
|
||||
}
|
||||
|
|
|
@ -103,12 +103,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
|||
}
|
||||
|
||||
|
||||
bool Socket::IsBindError(intptr_t error_number) {
|
||||
return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
|
||||
error_number == EINVAL;
|
||||
}
|
||||
|
||||
|
||||
intptr_t Socket::Available(intptr_t fd) {
|
||||
return FDUtils::AvailableBytes(fd);
|
||||
}
|
||||
|
|
|
@ -431,13 +431,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
|||
if (result is OSError) {
|
||||
// Keep first error, if present.
|
||||
if (error == null) {
|
||||
int errorCode = result.errorCode;
|
||||
if (errorCode != null && socket.isBindError(errorCode)) {
|
||||
error = createError(result, "Bind failed", sourceAddress);
|
||||
} else {
|
||||
error =
|
||||
createError(result, "Connection failed", address, port);
|
||||
}
|
||||
error = createError(result, "Connection failed", address, port);
|
||||
}
|
||||
connectNext();
|
||||
} else {
|
||||
|
@ -1081,7 +1075,6 @@ 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";
|
||||
|
|
|
@ -35,12 +35,6 @@ void FUNCTION_NAME(Socket_CreateBindConnect)(Dart_NativeArguments args) {
|
|||
}
|
||||
|
||||
|
||||
void FUNCTION_NAME(Socket_IsBindError)(Dart_NativeArguments args) {
|
||||
Dart_ThrowException(DartUtils::NewDartArgumentError(
|
||||
"Sockets unsupported on this platform"));
|
||||
}
|
||||
|
||||
|
||||
void FUNCTION_NAME(Socket_CreateBindDatagram)(Dart_NativeArguments args) {
|
||||
Dart_ThrowException(DartUtils::NewDartArgumentError(
|
||||
"Sockets unsupported on this platform"));
|
||||
|
|
|
@ -250,12 +250,6 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
|||
}
|
||||
|
||||
|
||||
bool Socket::IsBindError(intptr_t error_number) {
|
||||
return error_number == WSAEADDRINUSE || error_number == WSAEADDRNOTAVAIL ||
|
||||
error_number == WSAEINVAL;
|
||||
}
|
||||
|
||||
|
||||
void Socket::GetError(intptr_t fd, OSError* os_error) {
|
||||
Handle* handle = reinterpret_cast<Handle*>(fd);
|
||||
os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error());
|
||||
|
|
|
@ -43,8 +43,7 @@ Future testArguments(connectFunction) async {
|
|||
await throws(() => connectFunction('127.0.0.1',
|
||||
server.port,
|
||||
sourceAddress: sourceAddress),
|
||||
(e) => e is SocketException &&
|
||||
e.address == new InternetAddress('8.8.8.8'));
|
||||
(e) => e is SocketException);
|
||||
}
|
||||
// Address family mismatch.
|
||||
for (sourceAddress in ['::1', InternetAddress.LOOPBACK_IP_V6]) {
|
||||
|
|
Loading…
Reference in a new issue