Browse Source

Fixes ping merge issues.

dev1
paweldomas 10 years ago
parent
commit
c4bd9c71f1
2 changed files with 11 additions and 9 deletions
  1. 7
    5
      modules/xmpp/strophe.ping.js
  2. 4
    4
      modules/xmpp/xmpp.js

+ 7
- 5
modules/xmpp/strophe.ping.js View File

@@ -1,5 +1,7 @@
1 1
 /* global $, $iq, Strophe */
2 2
 
3
+var logger = require("jitsi-meet-logger").getLogger(__filename);
4
+
3 5
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4 6
 
5 7
 /**
@@ -67,7 +69,7 @@ module.exports = function (XMPP, eventEmitter) {
67 69
                     callback(ping.length > 0);
68 70
                 },
69 71
                 function (error) {
70
-                    console.error("Ping feature discovery error", error);
72
+                    logger.error("Ping feature discovery error", error);
71 73
                     callback(false);
72 74
                 }
73 75
             );
@@ -82,7 +84,7 @@ module.exports = function (XMPP, eventEmitter) {
82 84
          */
83 85
         startInterval: function (remoteJid, interval) {
84 86
             if (this.intervalId) {
85
-                console.error("Ping task scheduled already");
87
+                logger.error("Ping task scheduled already");
86 88
                 return;
87 89
             }
88 90
             if (!interval)
@@ -96,14 +98,14 @@ module.exports = function (XMPP, eventEmitter) {
96 98
                 },
97 99
                 function (error) {
98 100
                     self.failedPings += 1;
99
-                    console.error(
101
+                    logger.error(
100 102
                         "Ping " + (error ? "error" : "timeout"), error);
101 103
                     if (self.failedPings >= PING_THRESHOLD) {
102 104
                         self.connection.disconnect();
103 105
                     }
104 106
                 }, PING_TIMEOUT);
105 107
             }, interval);
106
-            console.info("XMPP pings will be sent every " + interval + " ms");
108
+            logger.info("XMPP pings will be sent every " + interval + " ms");
107 109
         },
108 110
 
109 111
         /**
@@ -114,7 +116,7 @@ module.exports = function (XMPP, eventEmitter) {
114 116
                 window.clearInterval(this.intervalId);
115 117
                 this.intervalId = null;
116 118
                 this.failedPings = 0;
117
-                console.info("Ping interval cleared");
119
+                logger.info("Ping interval cleared");
118 120
             }
119 121
         }
120 122
     });

+ 4
- 4
modules/xmpp/xmpp.js View File

@@ -114,14 +114,14 @@ XMPP.prototype._connect = function (jid, password) {
114 114
             logger.info("My Jabber ID: " + self.connection.jid);
115 115
 
116 116
             // Schedule ping ?
117
-            var pingJid = connection.domain;
118
-            connection.ping.hasPingSupport(
117
+            var pingJid = self.connection.domain;
118
+            self.connection.ping.hasPingSupport(
119 119
                 pingJid,
120 120
                 function (hasPing) {
121 121
                     if (hasPing)
122
-                        connection.ping.startInterval(pingJid);
122
+                        self.connection.ping.startInterval(pingJid);
123 123
                     else
124
-                        console.warn("Ping NOT supported by " + pingJid);
124
+                        logger.warn("Ping NOT supported by " + pingJid);
125 125
                 }
126 126
             );
127 127
             

Loading…
Cancel
Save