From cb1d0a54e1d3c4e104e5284a15d06717ee342c08 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 11 Jun 2020 11:23:58 -0700 Subject: [PATCH] More RDP flow control improvements. --- mstsc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mstsc.js b/mstsc.js index 12729fe1..692c6bde 100644 --- a/mstsc.js +++ b/mstsc.js @@ -139,7 +139,10 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain, u ws.on('close', function (req) { obj.close(0); }); // Send an object with flow control - function send(obj) { ws._socket.pause(); try { ws.send(JSON.stringify(obj), function () { ws._socket.resume(); }); } catch (ex) { } } + function send(obj) { + try { rdpClient.bufferLayer.socket.pause(); } catch (ex) { } + try { ws.send(JSON.stringify(obj), function () { try { rdpClient.bufferLayer.socket.resume(); } catch (ex) { } }); } catch (ex) { } + } // We are all set, start receiving data ws._socket.resume();