summaryrefslogtreecommitdiffstats
path: root/rdr
diff options
context:
space:
mode:
authorPeter Åstrand <astrand@cendio.se>2004-12-30 15:01:59 +0000
committerPeter Åstrand <astrand@cendio.se>2004-12-30 15:01:59 +0000
commit0fe254415653efdc58a0e7b233fbe86c6b791417 (patch)
treee8ac1824cdd88d87093f1d88cedd5162c88d7e22 /rdr
parentd06cf85526e873f9af0bb84c6f7b441451153983 (diff)
downloadtigervnc-0fe254415653efdc58a0e7b233fbe86c6b791417.tar.gz
tigervnc-0fe254415653efdc58a0e7b233fbe86c6b791417.zip
Bugfix for problem with line speed estimate staying at zero for a long
time. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@73 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rdr')
-rw-r--r--rdr/FdInStream.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/rdr/FdInStream.cxx b/rdr/FdInStream.cxx
index 397847a4..26e6d0df 100644
--- a/rdr/FdInStream.cxx
+++ b/rdr/FdInStream.cxx
@@ -128,8 +128,18 @@ int FdInStream::overrun(int itemSize, int nItems, bool wait)
end -= ptr - start;
ptr = start;
+ int bytes_to_read;
while (end < start + itemSize) {
- int n = readWithTimeoutOrCallback((U8*)end, start + bufSize - end, wait);
+ if (timing) {
+ bytes_to_read = start + bufSize - end;
+ } else {
+ // When not timing, we must be careful not to read extra data
+ // into the buffer. Otherwise, the line speed estimation might
+ // stay at zero for a long time: All reads during timing=1 can
+ // be satisfied without calling readWithTimeoutOrCallback.
+ bytes_to_read = start + itemSize*nItems - end;
+ }
+ int n = readWithTimeoutOrCallback((U8*)end, bytes_to_read, wait);
if (n == 0) return 0;
end += n;
}