Bug 980846 - Second wakeup message does not send the port. r=nsm.nikhil
authorGuillermo López <willyaranda@mozilla-hispano.org>
Mon, 10 Mar 2014 11:59:28 -0400
changeset 191006 efc8568dcf367efca6a4b4aac6846c1bf7cebffc
parent 191005 dcb2be82879840c617605ede36818f426d02dded
child 191007 20e2ef50fa8b55ce8309355cf0a0432fafe0fd54
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm
bugs980846
milestone30.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 980846 - Second wakeup message does not send the port. r=nsm.nikhil
dom/push/src/PushService.jsm
--- a/dom/push/src/PushService.jsm
+++ b/dom/push/src/PushService.jsm
@@ -1286,32 +1286,31 @@ this.PushService = {
             this._currentState + ". Skipping");
       return;
     }
 
     // Since we've had a successful connection reset the retry fail count.
     this._retryFailCount = 0;
 
     // Openning an available UDP port.
-    // _listenForUDPWakeup will return the opened port number
-    this._udpPort = this._listenForUDPWakeup();
+    this._listenForUDPWakeup();
 
     let data = {
       messageType: "hello",
     }
 
     if (this._UAID)
       data["uaid"] = this._UAID;
 
     let networkState = this._getNetworkState();
     if (networkState.ip) {
       // Hostport is apparently a thing.
       data["wakeup_hostport"] = {
         ip: networkState.ip,
-        port: this._udpPort
+        port: this._udpServer && this._udpServer.port
       };
 
       data["mobilenetwork"] = {
         mcc: networkState.mcc,
         mnc: networkState.mnc
       };
     }
 
@@ -1444,29 +1443,29 @@ this.PushService = {
     return this._udpServer.port;
   },
 
   /**
    * Called by UDP Server Socket. As soon as a ping is recieved via UDP,
    * reconnect the WebSocket and get the actual data.
    */
   onPacketReceived: function(aServ, aMessage) {
-    debug("Recv UDP datagram on port: " + this._udpPort);
+    debug("Recv UDP datagram on port: " + this._udpServer.port);
     this._beginWSSetup();
   },
 
   /**
    * Called by UDP Server Socket if the socket was closed for some reason.
    *
    * If this happens, we reconnect the WebSocket to not miss out on
    * notifications.
    */
   onStopListening: function(aServ, aStatus) {
     debug("UDP Server socket was shutdown. Status: " + aStatus);
-    this._udpPort = undefined;
+    this._udpServer = undefined;
     this._beginWSSetup();
   },
 
   /**
    * Get mobile network information to decide if the client is capable of being
    * woken up by UDP (which currently just means having an mcc and mnc along
    * with an IP).
    */