From 3acad0b3d64d953d29b88d8fd5494d6f0c02e73c Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Sun, 17 Oct 2021 22:13:13 -0700 Subject: [PATCH] Added workaround for bug where a connection reset causes an uncaught exception --- agents/meshcore.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index 5881e3b0..6e690def 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1794,21 +1794,27 @@ function onTunnelClosed() { } } - // Sent tunnel statistics to the server, only send this if compression was used. - if ((this.bytesSent_uncompressed) && (this.bytesSent_uncompressed.toString() != this.bytesSent_actual.toString())) { - mesh.SendCommand({ - action: 'tunnelCloseStats', - url: tunnel.url, - userid: tunnel.userid, - protocol: tunnel.protocol, - sessionid: tunnel.sessionid, - sent: this.bytesSent_uncompressed.toString(), - sentActual: this.bytesSent_actual.toString(), - sentRatio: this.bytesSent_ratio, - received: this.bytesReceived_uncompressed.toString(), - receivedActual: this.bytesReceived_actual.toString(), - receivedRatio: this.bytesReceived_ratio - }); + try + { + // Sent tunnel statistics to the server, only send this if compression was used. + if ((this.bytesSent_uncompressed) && (this.bytesSent_uncompressed.toString() != this.bytesSent_actual.toString())) { + mesh.SendCommand({ + action: 'tunnelCloseStats', + url: tunnel.url, + userid: tunnel.userid, + protocol: tunnel.protocol, + sessionid: tunnel.sessionid, + sent: this.bytesSent_uncompressed.toString(), + sentActual: this.bytesSent_actual.toString(), + sentRatio: this.bytesSent_ratio, + received: this.bytesReceived_uncompressed.toString(), + receivedActual: this.bytesReceived_actual.toString(), + receivedRatio: this.bytesReceived_ratio + }); + } + } + catch(z) + { } //sendConsoleText("Tunnel #" + this.httprequest.index + " closed. Sent -> " + this.bytesSent_uncompressed + ' bytes (uncompressed), ' + this.bytesSent_actual + ' bytes (actual), ' + this.bytesSent_ratio + '% compression', this.httprequest.sessionid);