aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2016-10-10 16:05:46 +0200
committerPierre Ossman <ossman@cendio.se>2016-10-10 16:05:46 +0200
commitb08b3d42d92e23b5712fec0da1ba784d8b26e2e4 (patch)
tree7f38447c24d376d2b4afb8de8a445cc694cbcbff /common
parent3c9012b56d71a6eebd3608406d32d977d08d603b (diff)
downloadtigervnc-b08b3d42d92e23b5712fec0da1ba784d8b26e2e4.tar.gz
tigervnc-b08b3d42d92e23b5712fec0da1ba784d8b26e2e4.zip
Fix busy loop in FdOutStream::flush()
This bug was introduced in c6df31db. A non-blocking socket that did not have any more space would busy loop until the write succeeded. Instead now it returns without any action, just as it did before the bug was introduced.
Diffstat (limited to 'common')
-rw-r--r--common/rdr/FdOutStream.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx
index e6d081a3..29e864fc 100644
--- a/common/rdr/FdOutStream.cxx
+++ b/common/rdr/FdOutStream.cxx
@@ -101,8 +101,13 @@ void FdOutStream::flush()
blocking? timeoutms : 0);
// Timeout?
- if ((n == 0) && blocking)
+ if (n == 0) {
+ // If non-blocking then we're done here
+ if (!blocking)
+ break;
+
throw TimedOut();
+ }
sentUpTo += n;
offset += n;