mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Report a peer address over IPv4 as IPv4.
R=asiva@google.com Review URL: https://codereview.chromium.org/2518263002 .
This commit is contained in:
parent
a3e1a0d395
commit
6c45f24fa6
|
@ -551,7 +551,7 @@ void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) {
|
|||
Dart_ListSetAt(entry, 1, Dart_NewStringFromCString(addr->as_string()));
|
||||
|
||||
RawAddr raw = addr->addr();
|
||||
intptr_t data_length = SocketAddress::GetAddrLength(raw);
|
||||
intptr_t data_length = SocketAddress::GetInAddrLength(raw);
|
||||
Dart_Handle data = Dart_NewTypedData(Dart_TypedData_kUint8, data_length);
|
||||
Dart_ListSetAsBytes(data, 0, reinterpret_cast<uint8_t*>(&raw), data_length);
|
||||
Dart_ListSetAt(entry, 2, data);
|
||||
|
|
|
@ -14,7 +14,11 @@ void testHostAndPort() {
|
|||
Expect.equals(clientSocket.port, socket.remotePort);
|
||||
Expect.equals(clientSocket.remotePort, socket.port);
|
||||
Expect.equals(socket.remoteAddress.address, "127.0.0.1");
|
||||
Expect.equals(socket.remoteAddress.type,
|
||||
InternetAddressType.IP_V4);
|
||||
Expect.equals(clientSocket.remoteAddress.address, "127.0.0.1");
|
||||
Expect.equals(clientSocket.remoteAddress.type,
|
||||
InternetAddressType.IP_V4);
|
||||
socket.destroy();
|
||||
clientSocket.destroy();
|
||||
server.close();
|
32
tests/standalone/io/socket_info_ipv6_test.dart
Normal file
32
tests/standalone/io/socket_info_ipv6_test.dart
Normal file
|
@ -0,0 +1,32 @@
|
|||
// 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "dart:io";
|
||||
|
||||
void testHostAndPort() {
|
||||
ServerSocket.bind("::1", 0).then((server) {
|
||||
|
||||
Socket.connect("::1", server.port).then((clientSocket) {
|
||||
server.listen((socket) {
|
||||
Expect.equals(socket.port, server.port);
|
||||
Expect.equals(clientSocket.port, socket.remotePort);
|
||||
Expect.equals(clientSocket.remotePort, socket.port);
|
||||
Expect.equals(socket.remoteAddress.address, "::1");
|
||||
Expect.equals(socket.remoteAddress.type,
|
||||
InternetAddressType.IP_V6);
|
||||
Expect.equals(clientSocket.remoteAddress.address, "::1");
|
||||
Expect.equals(clientSocket.remoteAddress.type,
|
||||
InternetAddressType.IP_V6);
|
||||
socket.destroy();
|
||||
clientSocket.destroy();
|
||||
server.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void main() {
|
||||
testHostAndPort();
|
||||
}
|
|
@ -352,10 +352,11 @@ io/test_runner_test: Pass, Slow # Slow.
|
|||
io/skipping_dart2js_compilations_test: Pass, Slow # Slow.
|
||||
|
||||
[ $builder_tag == no_ipv6 ]
|
||||
io/http_bind_test: Skip
|
||||
io/raw_datagram_socket_test: Skip
|
||||
io/socket_source_address_test: Skip
|
||||
io/socket_bind_test: Skip
|
||||
io/http_proxy_advanced_test: Skip
|
||||
io/http_ipv6_test: Skip
|
||||
io/socket_ipv6_test: Skip
|
||||
io/http_bind_test: SkipByDesign
|
||||
io/raw_datagram_socket_test: SkipByDesign
|
||||
io/socket_source_address_test: SkipByDesign
|
||||
io/socket_bind_test: SkipByDesign
|
||||
io/http_proxy_advanced_test: SkipByDesign
|
||||
io/http_ipv6_test: SkipByDesign
|
||||
io/socket_ipv6_test: SkipByDesign
|
||||
io/socket_info_ipv6_test: SkipByDesign
|
||||
|
|
Loading…
Reference in a new issue