Bug 1200132 - Part2: Get IP address by calling InetAddress.getHostAddress(), r=mcmanus, rnewman

This commit is contained in:
Kershaw Chang 2015-10-21 02:53:00 +02:00
parent 42ddfe4f02
commit f182f7563e
2 changed files with 3 additions and 2 deletions

View File

@ -204,7 +204,8 @@ class NsdMulticastDNSManager extends MulticastDNSManager implements NativeEventL
InetAddress host = serviceInfo.getHost();
if (host != null) {
obj.put("host", host.getHostName());
obj.put("host", host.getCanonicalHostName());
obj.put("address", host.getHostAddress());
}
int port = serviceInfo.getPort();

View File

@ -41,7 +41,7 @@ ListenerWrapper.prototype = {
makeServiceInfo: function (aServiceInfo) {
let serviceInfo = Cc[DNSSERVICEINFO_CONTRACT_ID].createInstance(Ci.nsIDNSServiceInfo);
for (let name of ['host', 'port', 'serviceName', 'serviceType']) {
for (let name of ['host', 'address', 'port', 'serviceName', 'serviceType']) {
try {
serviceInfo[name] = aServiceInfo[name];
} catch (e) {