Bug 1193605 - Part 4: add UUID for listeners; r=mcmanus
authorLiang-Heng Chen <xeonchen@mozilla.com>
Tue, 25 Aug 2015 07:17:00 +0200
changeset 296427 62e37d61a0961d6700518fa35c091dce7873f87c
parent 296426 bb221f207c1aa908dd1de4d1d6325d5f7c7e9346
child 296428 bd4e19973ec21cad1bb306701130eaf1e60035c5
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1193605
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1193605 - Part 4: add UUID for listeners; r=mcmanus
netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
--- a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
+++ b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js
@@ -11,26 +11,34 @@ Cu.import("resource://gre/modules/XPCOMU
 const DNSSERVICEDISCOVERY_CID = Components.ID("{f9346d98-f27a-4e89-b744-493843416480}");
 const DNSSERVICEDISCOVERY_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1";
 const DNSSERVICEINFO_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-info;1";
 
 function log(aMsg) {
   dump("-*- nsDNSServiceDiscovery.js : " + aMsg + "\n");
 }
 
+function generateUuid() {
+  var uuidGenerator = Components.classes["@mozilla.org/uuid-generator;1"].
+    getService(Ci.nsIUUIDGenerator);
+  return uuidGenerator.generateUUID().toString();
+}
+
 // Helper class to transform return objects to correct type.
 function ListenerWrapper(aListener, aMdns) {
   this.listener = aListener;
   this.mdns = aMdns;
 
   this.discoveryStarting = false;
   this.stopDiscovery = false;
 
   this.registrationStarting = false;
   this.stopRegistration = false;
+
+  this.uuid = generateUuid();
 }
 
 ListenerWrapper.prototype = {
   // Helper function for transforming an Object into nsIDNSServiceInfo.
   makeServiceInfo: function (aServiceInfo) {
     let serviceInfo = Cc[DNSSERVICEINFO_CONTRACT_ID].createInstance(Ci.nsIDNSServiceInfo);
 
     for (let name of ['host', 'port', 'serviceName', 'serviceType']) {