From c3ce5ced31402c30c19a98027c12c0124b954a0f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 19 Sep 2018 16:31:18 +0200 Subject: [PATCH] Don't attempt to send empty lossless refresh If we're out of time then we will definitely overshoot, so don't even try. --- common/rfb/VNCSConnectionST.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 41c6d239..01e86c17 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -1087,18 +1087,21 @@ void VNCSConnectionST::writeDataUpdate() if (!ui.is_empty()) encodeManager.writeUpdate(ui, server->getPixelBuffer(), cursor); else { - size_t maxUpdateSize; + int nextUpdate; // FIXME: If continuous updates aren't used then the client might // be slower than frameRate in its requests and we could // afford a larger update size + nextUpdate = server->msToNextUpdate(); + if (nextUpdate > 0) { + size_t maxUpdateSize; - // FIXME: Bandwidth estimation without congestion control - maxUpdateSize = congestion.getBandwidth() * - server->msToNextUpdate() / 1000; + // FIXME: Bandwidth estimation without congestion control + maxUpdateSize = congestion.getBandwidth() * nextUpdate / 1000; - encodeManager.writeLosslessRefresh(req, server->getPixelBuffer(), - cursor, maxUpdateSize); + encodeManager.writeLosslessRefresh(req, server->getPixelBuffer(), + cursor, maxUpdateSize); + } } writeRTTPing(); -- 2.39.5