From 419103b407795525c2f37669cc68fd18559e33ed Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Tue, 27 Feb 2018 14:48:37 +0100 Subject: [PATCH] Add cork --- lib/base/stream.cpp | 12 +++++++++++- lib/base/stream.hpp | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/base/stream.cpp b/lib/base/stream.cpp index 4e0ad72dc..4a0ebd377 100644 --- a/lib/base/stream.cpp +++ b/lib/base/stream.cpp @@ -60,7 +60,7 @@ void Stream::SignalDataAvailable(void) } } -bool Stream::WaitForData() +bool Stream::WaitForData(void) { if (!SupportsWaiting()) BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting.")); @@ -94,6 +94,16 @@ bool Stream::WaitForData(int timeout) static void StreamDummyCallback(void) { } +void Stream::SetCorked(bool corked) +{ + m_Corked = corked; +} + +bool Stream::IsCorked(void) const +{ + return m_Corked; +} + void Stream::Close(void) { OnDataAvailable.disconnect_all_slots(); diff --git a/lib/base/stream.hpp b/lib/base/stream.hpp index 63ac31599..79c8aa0c8 100644 --- a/lib/base/stream.hpp +++ b/lib/base/stream.hpp @@ -131,6 +131,9 @@ public: virtual bool SupportsWaiting(void) const; + virtual void SetCorked(bool corked); + bool IsCorked(void) const; + virtual bool IsDataAvailable(void) const; void RegisterDataHandler(const boost::function& handler); @@ -145,6 +148,8 @@ private: boost::mutex m_Mutex; boost::condition_variable m_CV; + + bool m_Corked{false}; }; } -- 2.40.0