]> source.dussan.org Git - tigervnc.git/commitdiff
Don't attempt to send empty lossless refresh
authorPierre Ossman <ossman@cendio.se>
Wed, 19 Sep 2018 14:31:18 +0000 (16:31 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 20 Sep 2018 10:08:46 +0000 (12:08 +0200)
If we're out of time then we will definitely overshoot, so don't even
try.

common/rfb/VNCSConnectionST.cxx

index 41c6d239b5ae19fdc25f1e349e87055c0462a177..01e86c17ee153836773cbd3014ffc634814f438f 100644 (file)
@@ -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();