From 119bf305ae219c4217fa1eea2b2e7dc69d109ed0 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 2 Jul 2021 09:32:28 -0700 Subject: [PATCH] Fix for #2855. TCP/UDP exception on close. --- agents/meshcore.js | 6 +++--- package.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index 44c447ff..fdf3cd30 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -871,7 +871,7 @@ function handleServerCommand(data) { woptions.checkServerIdentity.servertlshash = data.servertlshash; //sendConsoleText(JSON.stringify(woptions)); - sendConsoleText('TUNNEL: ' + JSON.stringify(data)); + //sendConsoleText('TUNNEL: ' + JSON.stringify(data)); var tunnel = http.request(woptions); tunnel.upgrade = onTunnelUpgrade; tunnel.on('error', function (e) { sendConsoleText("ERROR: Unable to connect relay tunnel to: " + this.url + ", " + JSON.stringify(e)); }); @@ -1648,12 +1648,12 @@ function onTunnelClosed() { // If this is a routing session, clean up and send the new session counts. if (this.httprequest.userid != null) { if (this.httprequest.tcpport != null) { - var userid = getUserIdAndGuestNameFromHttpRequest(s.httprequest); + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); if (tunnelUserCount.tcp[userid] != null) { tunnelUserCount.tcp[userid]--; if (tunnelUserCount.tcp[userid] <= 0) { delete tunnelUserCount.tcp[userid]; } } try { mesh.SendCommand({ action: 'sessions', type: 'tcp', value: tunnelUserCount.tcp }); } catch (e) { } broadcastSessionsToRegisteredApps(); } else if (this.httprequest.udpport != null) { - var userid = getUserIdAndGuestNameFromHttpRequest(s.httprequest); + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest); if (tunnelUserCount.udp[userid] != null) { tunnelUserCount.udp[userid]--; if (tunnelUserCount.udp[userid] <= 0) { delete tunnelUserCount.udp[userid]; } } try { mesh.SendCommand({ action: 'sessions', type: 'udp', value: tunnelUserCount.udp }); } catch (e) { } broadcastSessionsToRegisteredApps(); diff --git a/package.json b/package.json index a2254a2c..55433f13 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "node-windows": "^1.0.0-beta.5", "nodemailer": "^6.6.2", "otplib": "^10.2.3", + "saslprep": "^1.0.3", "ssh2": "^1.1.0", "web-push": "^3.4.5", "ws": "^5.2.0",