From: Pierre Ossman Date: Mon, 10 Oct 2016 14:05:46 +0000 (+0200) Subject: Fix busy loop in FdOutStream::flush() X-Git-Tag: v1.7.90~74 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b08b3d42d92e23b5712fec0da1ba784d8b26e2e4;p=tigervnc.git 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. --- 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;