From c6df31db54bffe76ee5506a79f42cc7de7c541c3 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 29 Apr 2016 13:40:13 +0200 Subject: Clean up FdOutStream::flush() The logic was a bit confusing and superfluous. --- common/rdr/FdOutStream.cxx | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'common/rdr') 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; -- cgit v1.2.3