aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2016-04-29 13:40:13 +0200
committerPierre Ossman <ossman@cendio.se>2016-04-29 13:40:13 +0200
commitc6df31db54bffe76ee5506a79f42cc7de7c541c3 (patch)
treea04f32fb40195d41eb330ad16b39d9154b30a9c2 /common
parent3b46a398b1dcaad78aaf237bc3e6c200de452650 (diff)
downloadtigervnc-c6df31db54bffe76ee5506a79f42cc7de7c541c3.tar.gz
tigervnc-c6df31db54bffe76ee5506a79f42cc7de7c541c3.zip
Clean up FdOutStream::flush()
The logic was a bit confusing and superfluous.
Diffstat (limited to 'common')
-rw-r--r--common/rdr/FdOutStream.cxx24
1 files changed, 3 insertions, 21 deletions
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx
index 520853ff..e6d081a3 100644
--- a/common/rdr/FdOutStream.cxx
+++ b/common/rdr/FdOutStream.cxx
@@ -95,32 +95,14 @@ unsigned FdOutStream::getIdleTime()
void FdOutStream::flush()
{
- int timeoutms_;
-
- if (blocking)
- timeoutms_ = timeoutms;
- else
- timeoutms_ = 0;
-
while (sentUpTo < ptr) {
int n = writeWithTimeout((const void*) sentUpTo,
- ptr - sentUpTo, timeoutms_);
+ ptr - sentUpTo,
+ blocking? timeoutms : 0);
// Timeout?
- if (n == 0) {
- // If non-blocking then we're done here
- if (!blocking)
- break;
-
- // Otherwise try blocking (with possible timeout)
- if ((timeoutms_ == 0) && (timeoutms != 0)) {
- timeoutms_ = timeoutms;
- break;
- }
-
- // Proper timeout
+ if ((n == 0) && blocking)
throw TimedOut();
- }
sentUpTo += n;
offset += n;