Fix for #2855. TCP/UDP exception on close.

Ylian Saint-Hilaire committed Jul 2, 2021 at 09:32 UTC 119bf305ae219c4217fa1eea2b2e7dc69d109ed0
2 files changed +4 -3
agents/meshcore.js
+3 -3
@@ -871,7 +871,7 @@ function handleServerCommand(data) {
871 woptions.checkServerIdentity.servertlshash = data.servertlshash;
872
873 //sendConsoleText(JSON.stringify(woptions));
874 - sendConsoleText('TUNNEL: ' + JSON.stringify(data));
874 + //sendConsoleText('TUNNEL: ' + JSON.stringify(data));
875 var tunnel = http.request(woptions);
876 tunnel.upgrade = onTunnelUpgrade;
877 tunnel.on('error', function (e) { sendConsoleText("ERROR: Unable to connect relay tunnel to: " + this.url + ", " + JSON.stringify(e)); });
@@ -1648,12 +1648,12 @@ function onTunnelClosed() {
1648 // If this is a routing session, clean up and send the new session counts.
1649 if (this.httprequest.userid != null) {
1650 if (this.httprequest.tcpport != null) {
1651 - var userid = getUserIdAndGuestNameFromHttpRequest(s.httprequest);
1651 + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest);
1652 if (tunnelUserCount.tcp[userid] != null) { tunnelUserCount.tcp[userid]--; if (tunnelUserCount.tcp[userid] <= 0) { delete tunnelUserCount.tcp[userid]; } }
1653 try { mesh.SendCommand({ action: 'sessions', type: 'tcp', value: tunnelUserCount.tcp }); } catch (e) { }
1654 broadcastSessionsToRegisteredApps();
1655 } else if (this.httprequest.udpport != null) {
1656 - var userid = getUserIdAndGuestNameFromHttpRequest(s.httprequest);
1656 + var userid = getUserIdAndGuestNameFromHttpRequest(this.httprequest);
1657 if (tunnelUserCount.udp[userid] != null) { tunnelUserCount.udp[userid]--; if (tunnelUserCount.udp[userid] <= 0) { delete tunnelUserCount.udp[userid]; } }
1658 try { mesh.SendCommand({ action: 'sessions', type: 'udp', value: tunnelUserCount.udp }); } catch (e) { }
1659 broadcastSessionsToRegisteredApps();
package.json
+1
@@ -57,6 +57,7 @@
57 "node-windows": "^1.0.0-beta.5",
58 "nodemailer": "^6.6.2",
59 "otplib": "^10.2.3",
60 + "saslprep": "^1.0.3",
61 "ssh2": "^1.1.0",
62 "web-push": "^3.4.5",
63 "ws": "^5.2.0",