From f37d0abddab97841ec8c97238c9c67f61047cacc Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 1 Apr 2021 11:39:35 -0700 Subject: [PATCH] Removed any ping/pong on MSTSC channel. --- meshrelay.js | 8 +++++--- mstsc.js | 2 +- public/mstsc/client.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/meshrelay.js b/meshrelay.js index 474af789..72f997f3 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -299,9 +299,11 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) { // Remove the timeout if (relayinfo.timeout) { clearTimeout(relayinfo.timeout); delete relayinfo.timeout; } - // Setup the agent PING/PONG timers - if ((typeof parent.parent.args.agentping == 'number') && (obj.pingtimer == null)) { obj.pingtimer = setInterval(sendPing, parent.parent.args.agentping * 1000); } - else if ((typeof parent.parent.args.agentpong == 'number') && (obj.pongtimer == null)) { obj.pongtimer = setInterval(sendPong, parent.parent.args.agentpong * 1000); } + // Setup the agent PING/PONG timers unless requested not to + if ((obj.req.query.noping != 1) && (obj.peer.req != null) && (obj.peer.req.query != null) && (obj.peer.req.query.noping != 1)) { + if ((typeof parent.parent.args.agentping == 'number') && (obj.pingtimer == null)) { obj.pingtimer = setInterval(sendPing, parent.parent.args.agentping * 1000); } + else if ((typeof parent.parent.args.agentpong == 'number') && (obj.pongtimer == null)) { obj.pongtimer = setInterval(sendPong, parent.parent.args.agentpong * 1000); } + } // Setup session recording var sessionUser = obj.user; diff --git a/mstsc.js b/mstsc.js index 9df235cc..f6898e2a 100644 --- a/mstsc.js +++ b/mstsc.js @@ -67,7 +67,7 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) { if (args.tlsoffload) { protocol = 'ws'; } var domainadd = ''; if ((domain.dns == null) && (domain.id != '')) { domainadd = domain.id + '/' } - var url = protocol + '://127.0.0.1:' + args.port + '/' + domainadd + 'meshrelay.ashx?auth=' + obj.infos.ip; + var url = protocol + '://127.0.0.1:' + args.port + '/' + domainadd + 'meshrelay.ashx?noping=1&auth=' + obj.infos.ip; parent.parent.debug('relay', 'RDP: Connection websocket to ' + url); obj.wsClient = new WebSocket(url, options); obj.wsClient.on('open', function () { parent.parent.debug('relay', 'RDP: Relay websocket open'); }); diff --git a/public/mstsc/client.js b/public/mstsc/client.js index bb88f5b1..305a2030 100644 --- a/public/mstsc/client.js +++ b/public/mstsc/client.js @@ -150,7 +150,7 @@ connect : function (ip, domain, username, password, next) { // Start connection var self = this; - this.socket = new WebSocket("wss://" + window.location.host + "/mstsc/relay.ashx"); + this.socket = new WebSocket('wss://' + window.location.host + '/mstsc/relay.ashx'); this.socket.binaryType = 'arraybuffer'; this.socket.onopen = function () { //console.log("WS-OPEN");