Limit lossless refresh update to safe size
We don't want to waste bandwidth on the lossless refresh if we might
need that bandwidth for a normal update. Try to estimate how much
data we can safely send without interfering.
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 77a6058..3f92a42 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -1067,8 +1067,20 @@
if (!ui.is_empty())
encodeManager.writeUpdate(ui, server->getPixelBuffer(), cursor);
- else
- encodeManager.writeLosslessRefresh(req, server->getPixelBuffer(), cursor);
+ else {
+ size_t maxUpdateSize;
+
+ // 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
+
+ // FIXME: Bandwidth estimation without congestion control
+ maxUpdateSize = congestion.getBandwidth() *
+ server->msToNextUpdate() / 1000;
+
+ encodeManager.writeLosslessRefresh(req, server->getPixelBuffer(),
+ cursor, maxUpdateSize);
+ }
writeRTTPing();