| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 patch class RawServerSocket { | 5 patch class RawServerSocket { |
| 6 /* patch */ static Future<RawServerSocket> bind(address, | 6 /* patch */ static Future<RawServerSocket> bind(address, |
| 7 int port, | 7 int port, |
| 8 {int backlog: 0}) { | 8 {int backlog: 0}) { |
| 9 return _RawServerSocket.bind(address, port, backlog); | 9 return _RawServerSocket.bind(address, port, backlog); |
| 10 } | 10 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 /* patch */ static InternetAddress get ANY_IP_V4 { | 30 /* patch */ static InternetAddress get ANY_IP_V4 { |
| 31 return _InternetAddress.ANY_IP_V4; | 31 return _InternetAddress.ANY_IP_V4; |
| 32 } | 32 } |
| 33 | 33 |
| 34 /* patch */ static InternetAddress get ANY_IP_V6 { | 34 /* patch */ static InternetAddress get ANY_IP_V6 { |
| 35 return _InternetAddress.ANY_IP_V6; | 35 return _InternetAddress.ANY_IP_V6; |
| 36 } | 36 } |
| 37 | 37 |
| 38 /* patch */ static Future<List<InternetAddress>> lookup( | 38 /* patch */ static Future<List<InternetAddress>> lookup( |
| 39 String host, {InternetAddressType type: InternetAddressType.IP_V4}) { | 39 String host, {InternetAddressType type: InternetAddressType.ANY}) { |
| 40 return _NativeSocket.lookup(host, type: type); | 40 return _NativeSocket.lookup(host, type: type); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 class _InternetAddress implements InternetAddress { | 44 class _InternetAddress implements InternetAddress { |
| 45 static const int _ADDRESS_LOOPBACK_IP_V4 = 0; | 45 static const int _ADDRESS_LOOPBACK_IP_V4 = 0; |
| 46 static const int _ADDRESS_LOOPBACK_IP_V6 = 1; | 46 static const int _ADDRESS_LOOPBACK_IP_V6 = 1; |
| 47 static const int _ADDRESS_ANY_IP_V4 = 2; | 47 static const int _ADDRESS_ANY_IP_V4 = 2; |
| 48 static const int _ADDRESS_ANY_IP_V6 = 3; | 48 static const int _ADDRESS_ANY_IP_V6 = 3; |
| 49 | 49 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Holds the port of the socket, null if not known. | 151 // Holds the port of the socket, null if not known. |
| 152 int localPort; | 152 int localPort; |
| 153 | 153 |
| 154 // Holds the address used to connect or bind the socket. | 154 // Holds the address used to connect or bind the socket. |
| 155 InternetAddress address; | 155 InternetAddress address; |
| 156 | 156 |
| 157 // Native port for socket services. | 157 // Native port for socket services. |
| 158 static SendPort socketService; | 158 static SendPort socketService; |
| 159 | 159 |
| 160 static Future<List<InternetAddress>> lookup( | 160 static Future<List<InternetAddress>> lookup( |
| 161 String host, {InternetAddressType type: InternetAddressType.IP_V4}) { | 161 String host, {InternetAddressType type: InternetAddressType.ANY}) { |
| 162 ensureSocketService(); | 162 ensureSocketService(); |
| 163 return socketService.call([HOST_NAME_LOOKUP, host, type._value]) | 163 return socketService.call([HOST_NAME_LOOKUP, host, type._value]) |
| 164 .then((response) { | 164 .then((response) { |
| 165 if (isErrorResponse(response)) { | 165 if (isErrorResponse(response)) { |
| 166 throw createError(response, "Failed host name lookup"); | 166 throw createError(response, "Failed host name lookup"); |
| 167 } else { | 167 } else { |
| 168 return response.skip(1).map((result) { | 168 return response.skip(1).map((result) { |
| 169 var type = new InternetAddressType._from(result[0]); | 169 var type = new InternetAddressType._from(result[0]); |
| 170 return new _InternetAddress(type, result[1], host, result[2]); | 170 return new _InternetAddress(type, result[1], host, result[2]); |
| 171 }).toList(); | 171 }).toList(); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 _raw.onBadCertificate = callback; | 1088 _raw.onBadCertificate = callback; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 X509Certificate get peerCertificate { | 1091 X509Certificate get peerCertificate { |
| 1092 if (_raw == null) { | 1092 if (_raw == null) { |
| 1093 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 1093 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
| 1094 } | 1094 } |
| 1095 return _raw.peerCertificate; | 1095 return _raw.peerCertificate; |
| 1096 } | 1096 } |
| 1097 } | 1097 } |
| OLD | NEW |