Removed the agent relay timeout that causes disconnections after 5 seconds (#4352)
Ylian Saint-Hilaire committed
Aug 1, 2022 at 11:00 UTC
5f04c7a5d26c56fb25820b1ac5c33af228a7abb6
1 file changed
+6
-2
agents/meshcore.js
+6
-2
@@ -1885,8 +1885,8 @@ function onTunnelUpgrade(response, s, head) {
1885
s.tunnel = this;
1886
s.descriptorMetadata = "MeshAgent_relayTunnel";
1887
1888
-
1889
- if (this.tcpport != null || this.udpport != null)
1888
+ //if (this.tcpport != null || this.udpport != null)
1889
+ if (require('MeshAgent').idleTimeout != null)
1890
{
1891
s.setTimeout(require('MeshAgent').idleTimeout * 1000);
1892
s.on('timeout', function ()
@@ -2086,15 +2086,18 @@ function onTunnelData(data) {
2086
if ((data == 'c') || (data == 'cr'))
2087
{
2088
this.httprequest.state = 1; /*sendConsoleText("Tunnel #" + this.httprequest.index + " now active", this.httprequest.sessionid);*/
2089
+ /*
2090
this.setTimeout(global._tunnelTimeout == null ? 5000 : global._tunnelTimeout); // Once we receive 'c', we will only wait the tunnel timeout (5 seconds) before we close the tunnel
2091
this.on('timeout', function ()
2092
{
2093
this.end();
2094
});
2095
+ */
2096
}
2097
}
2098
else
2099
{
2100
+ /*
2101
// We received some data, so we will reset the idle timeout of the websocket
2102
this.removeAllListeners('timeout');
2103
@@ -2107,6 +2110,7 @@ function onTunnelData(data) {
2110
this.setTimeout(require('MeshAgent').idleTimeout * 1000);
2111
});
2112
}
2113
+ */
2114
2115
// Handle tunnel data
2116
if (this.httprequest.protocol == 0) { // 1 = Terminal (admin), 2 = Desktop, 5 = Files, 6 = PowerShell (admin), 7 = Plugin Data Exchange, 8 = Terminal (user), 9 = PowerShell (user), 10 = FileTransfer