More RDP flow control improvements.

Ylian Saint-Hilaire committed Jun 11, 2020 at 11:23 UTC b6a33715b6b9ca56a8e2c9ad9d8300776d1e9362
1 file changed +4 -1
mstsc.js
+4 -1
@@ -139,7 +139,10 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain, u
139 ws.on('close', function (req) { obj.close(0); });
140
141 // Send an object with flow control
142 - function send(obj) { ws._socket.pause(); try { ws.send(JSON.stringify(obj), function () { ws._socket.resume(); }); } catch (ex) { } }
142 + function send(obj) {
143 + try { rdpClient.bufferLayer.socket.pause(); } catch (ex) { }
144 + try { ws.send(JSON.stringify(obj), function () { try { rdpClient.bufferLayer.socket.resume(); } catch (ex) { } }); } catch (ex) { }
145 + }
146
147 // We are all set, start receiving data
148 ws._socket.resume();