From a85024e0667a972578bca4fad499968630394d77 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Fri, 20 Nov 2015 14:17:32 -0600 Subject: [PATCH] Fixes ping merge issues. --- modules/xmpp/strophe.ping.js | 12 +++++++----- modules/xmpp/xmpp.js | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/xmpp/strophe.ping.js b/modules/xmpp/strophe.ping.js index 1ac534595..e792ce676 100644 --- a/modules/xmpp/strophe.ping.js +++ b/modules/xmpp/strophe.ping.js @@ -1,5 +1,7 @@ /* global $, $iq, Strophe */ +var logger = require("jitsi-meet-logger").getLogger(__filename); + var XMPPEvents = require("../../service/xmpp/XMPPEvents"); /** @@ -67,7 +69,7 @@ module.exports = function (XMPP, eventEmitter) { callback(ping.length > 0); }, function (error) { - console.error("Ping feature discovery error", error); + logger.error("Ping feature discovery error", error); callback(false); } ); @@ -82,7 +84,7 @@ module.exports = function (XMPP, eventEmitter) { */ startInterval: function (remoteJid, interval) { if (this.intervalId) { - console.error("Ping task scheduled already"); + logger.error("Ping task scheduled already"); return; } if (!interval) @@ -96,14 +98,14 @@ module.exports = function (XMPP, eventEmitter) { }, function (error) { self.failedPings += 1; - console.error( + logger.error( "Ping " + (error ? "error" : "timeout"), error); if (self.failedPings >= PING_THRESHOLD) { self.connection.disconnect(); } }, PING_TIMEOUT); }, interval); - console.info("XMPP pings will be sent every " + interval + " ms"); + logger.info("XMPP pings will be sent every " + interval + " ms"); }, /** @@ -114,7 +116,7 @@ module.exports = function (XMPP, eventEmitter) { window.clearInterval(this.intervalId); this.intervalId = null; this.failedPings = 0; - console.info("Ping interval cleared"); + logger.info("Ping interval cleared"); } } }); diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js index a9d2fdc02..00ac47a95 100644 --- a/modules/xmpp/xmpp.js +++ b/modules/xmpp/xmpp.js @@ -114,14 +114,14 @@ XMPP.prototype._connect = function (jid, password) { logger.info("My Jabber ID: " + self.connection.jid); // Schedule ping ? - var pingJid = connection.domain; - connection.ping.hasPingSupport( + var pingJid = self.connection.domain; + self.connection.ping.hasPingSupport( pingJid, function (hasPing) { if (hasPing) - connection.ping.startInterval(pingJid); + self.connection.ping.startInterval(pingJid); else - console.warn("Ping NOT supported by " + pingJid); + logger.warn("Ping NOT supported by " + pingJid); } );