Index: runtime/bin/socket_patch.dart |
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart |
index fb93b8bce9beaca95bae8657d9608e2ac5c206cd..a4b9c83d35f4bcede943aab52551d58e6ad447b7 100644 |
--- a/runtime/bin/socket_patch.dart |
+++ b/runtime/bin/socket_patch.dart |
@@ -73,9 +73,11 @@ class _InternetAddress implements InternetAddress { |
final InternetAddressType type; |
final String address; |
- final String host; |
+ final String _host; |
final Uint8List _sockaddr_storage; |
+ String get host => _host != null ? _host : address; |
+ |
bool get isLoopback { |
switch (type) { |
case InternetAddressType.IP_V4: |
@@ -108,7 +110,7 @@ class _InternetAddress implements InternetAddress { |
_InternetAddress(InternetAddressType this.type, |
String this.address, |
- String this.host, |
+ String this._host, |
List<int> this._sockaddr_storage); |
factory _InternetAddress.fixed(int id) { |
@@ -116,10 +118,10 @@ class _InternetAddress implements InternetAddress { |
switch (id) { |
case _ADDRESS_LOOPBACK_IP_V4: |
return new _InternetAddress( |
- InternetAddressType.IP_V4, "127.0.0.1", "localhost", sockaddr); |
+ InternetAddressType.IP_V4, "127.0.0.1", null, sockaddr); |
case _ADDRESS_LOOPBACK_IP_V6: |
return new _InternetAddress( |
- InternetAddressType.IP_V6, "::1", "ip6-localhost", sockaddr); |
+ InternetAddressType.IP_V6, "::1", null, sockaddr); |
case _ADDRESS_ANY_IP_V4: |
return new _InternetAddress( |
InternetAddressType.IP_V4, "0.0.0.0", "0.0.0.0", sockaddr); |
@@ -443,7 +445,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 { |
InternetAddress get remoteAddress { |
var result = nativeGetRemotePeer()[0]; |
var type = new InternetAddressType._from(result[0]); |
- return new _InternetAddress(type, result[1], "", result[2]); |
+ return new _InternetAddress(type, result[1], null, result[2]); |
} |
// Multiplexes socket events to the socket handlers. |