1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed tunnel ping/pong that would corrupt traffic.

This commit is contained in:
Ylian Saint-Hilaire 2020-07-19 14:45:29 -07:00
parent 154c503e97
commit eacc7c91b2
5 changed files with 13 additions and 2 deletions

View file

@ -1179,7 +1179,10 @@ function createMeshCore(agent) {
// Called when we get data from the server for a TCP relay (We have to skip the first received 'c' and pipe the rest)
function onTcpRelayServerTunnelData(data) {
if (this.first == true) { this.first = false; this.pipe(this.tcprelay); } // Pipe Server --> Target
if (this.first == true) {
this.first = false;
this.pipe(this.tcprelay, { dataTypeSkip: 1 }); // Pipe Server --> Target (don't pipe text type websocket frames)
}
}
function onTunnelClosed() {
@ -2279,6 +2282,13 @@ function createMeshCore(agent) {
if (sdp != null) { ws.write({ type: 'answer', ctrlChannel: '102938', sdp: sdp }); }
break;
}
case 'ping': {
ws.write("{\"ctrlChannel\":\"102938\",\"type\":\"pong\"}"); // Send pong response
break;
}
case 'pong': { // NOP
break;
}
case 'rtt': {
ws.write({ type: 'rtt', ctrlChannel: '102938', time: obj.time });
break;