Added workaround for bug where a connection reset causes an uncaught exception
Bryan Roe committed
Oct 17, 2021 at 22:13 UTC
3acad0b3d64d953d29b88d8fd5494d6f0c02e73c
1 file changed
+21
-15
agents/meshcore.js
+21
-15
@@ -1794,21 +1794,27 @@ function onTunnelClosed() {
1794
}
1795
}
1796
1797
- // Sent tunnel statistics to the server, only send this if compression was used.
1798
- if ((this.bytesSent_uncompressed) && (this.bytesSent_uncompressed.toString() != this.bytesSent_actual.toString())) {
1799
- mesh.SendCommand({
1800
- action: 'tunnelCloseStats',
1801
- url: tunnel.url,
1802
- userid: tunnel.userid,
1803
- protocol: tunnel.protocol,
1804
- sessionid: tunnel.sessionid,
1805
- sent: this.bytesSent_uncompressed.toString(),
1806
- sentActual: this.bytesSent_actual.toString(),
1807
- sentRatio: this.bytesSent_ratio,
1808
- received: this.bytesReceived_uncompressed.toString(),
1809
- receivedActual: this.bytesReceived_actual.toString(),
1810
- receivedRatio: this.bytesReceived_ratio
1811
- });
1797
+ try
1798
+ {
1799
+ // Sent tunnel statistics to the server, only send this if compression was used.
1800
+ if ((this.bytesSent_uncompressed) && (this.bytesSent_uncompressed.toString() != this.bytesSent_actual.toString())) {
1801
+ mesh.SendCommand({
1802
+ action: 'tunnelCloseStats',
1803
+ url: tunnel.url,
1804
+ userid: tunnel.userid,
1805
+ protocol: tunnel.protocol,
1806
+ sessionid: tunnel.sessionid,
1807
+ sent: this.bytesSent_uncompressed.toString(),
1808
+ sentActual: this.bytesSent_actual.toString(),
1809
+ sentRatio: this.bytesSent_ratio,
1810
+ received: this.bytesReceived_uncompressed.toString(),
1811
+ receivedActual: this.bytesReceived_actual.toString(),
1812
+ receivedRatio: this.bytesReceived_ratio
1813
+ });
1814
+ }
1815
+ }
1816
+ catch(z)
1817
+ {
1818
}
1819
1820
//sendConsoleText("Tunnel #" + this.httprequest.index + " closed. Sent -> " + this.bytesSent_uncompressed + ' bytes (uncompressed), ' + this.bytesSent_actual + ' bytes (actual), ' + this.bytesSent_ratio + '% compression', this.httprequest.sessionid);