From a20a4330445f03d1bd33c707f26d1eafd666d0a1 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Thu, 17 Feb 2022 15:59:32 -0500 Subject: [PATCH] WIP cleanup --- core/decoders/udp.js | 12 +----------- core/rfb.js | 6 ++---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/core/decoders/udp.js b/core/decoders/udp.js index 75d11ba0..44836c7b 100644 --- a/core/decoders/udp.js +++ b/core/decoders/udp.js @@ -30,23 +30,18 @@ export default class UDPDecoder { let ret; if (ctl === 0x08) { - Log.Info("Fill Rect"); ret = this._fillRect(x, y, width, height, data, display, depth); } else if (ctl === 0x09) { - Log.Info("Fill JPEG"); ret = this._jpegRect(x, y, width, height, data, display, depth); } else if (ctl === 0x0A) { - Log.Info("Fill Png"); ret = this._pngRect(x, y, width, height, data, display, depth); } else if ((ctl & 0x08) == 0) { - Log.Info("Fill Basic"); ret = this._basicRect(ctl, x, y, width, height, data, display, depth); } else if (ctl === 0x0B) { - Log.Info("Fill webp"); ret = this._webpRect(x, y, width, height, data, display, depth); } else { @@ -115,17 +110,14 @@ export default class UDPDecoder { switch (filter) { case 0: // CopyFilter - Log.Info("Filter Copy"); ret = this._copyFilter(streamId, x, y, width, height, data, display, depth, data_index); break; case 1: // PaletteFilter - Log.Info("Filter Palette"); ret = this._paletteFilter(streamId, x, y, width, height, data, display, depth); break; case 2: // GradientFilter - Log.Info("Filter Gradient"); ret = this._gradientFilter(streamId, x, y, width, height, data, display, depth); break; @@ -146,7 +138,6 @@ export default class UDPDecoder { if (uncompressedSize < 12) { data = data.slice(data_index, data_index + uncompressedSize); - //data = sock.rQshiftBytes(uncompressedSize); } else { data = this._readData(data, data_index); if (data === null) { @@ -186,7 +177,6 @@ export default class UDPDecoder { } if (uncompressedSize < 12) { - //data = sock.rQshiftBytes(uncompressedSize); data = data.slice(data_i, data_i + uncompressedSize); } else { data = this._readData(data, data_i); @@ -281,7 +271,7 @@ export default class UDPDecoder { } } - // get rid of me + //TODO: get rid of me if (data.length !== len + i) { console.log('Rect of size ' + len + ' with data size ' + data.length + ' index of ' + i); } diff --git a/core/rfb.js b/core/rfb.js index b701c663..6a0ef221 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -928,7 +928,7 @@ export default class RFB extends EventTargetMixin { let udpurl = this._url.split("/")[2]; udpurl = udpurl.split(":")[0]; - udpurl = "http://" + udpurl + ":" + 9555; + udpurl = "http://" + udpurl + ":" + 9555; //udpurl = window.location.protocol + "//" + udpurl + ":" + 9555; this._udpPeer = new RTCPeerConnection({ @@ -980,7 +980,6 @@ export default class RFB extends EventTargetMixin { (u8[11] << 24), 10); if (pieces == 1) { // Handle it immediately - Log.Info("Single Piece recieved"); me._handleUdpRect(u8.slice(12)); } else { // Insert into wait array const now = Date.now(); @@ -1003,7 +1002,6 @@ export default class RFB extends EventTargetMixin { finaldata.set(item.data[x], z); z += item.data[x].length; } - Log.Info('Completed message applied: ' + finaldata.length + ' ' + item.total_bytes + ' ' + item.total_pieces); udpBuffer.delete(id); me._handleUdpRect(finaldata); } @@ -1027,7 +1025,7 @@ export default class RFB extends EventTargetMixin { for (const [key, value] of udpBuffer.entries()) { // Drop any messages older than 100ms if (now - value.arrival > 100) { - Log.Info('Removed id: ' + key); + Log.Info('Removed id: ' + key + ' Buffer size: ' + udpBuffer.size); udpBuffer.delete(key); } }