]> granicus.if.org Git - icinga2/commitdiff
Add cork
authorJean Flach <jean-marcel.flach@icinga.com>
Tue, 27 Feb 2018 13:48:37 +0000 (14:48 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 28 Feb 2018 11:50:49 +0000 (12:50 +0100)
lib/base/stream.cpp
lib/base/stream.hpp

index 4e0ad72dcb49ddfc26124ecfe3d4267c932e57f2..4a0ebd37788d4f04ae48c4f6899e06aa975a511d 100644 (file)
@@ -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();
index 63ac31599029cbc93eedb7c792c7bc3ef16cf07c..79c8aa0c8957cb124b3602b2f3bd80f81c1c1f7f 100644 (file)
@@ -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<void(const Stream::Ptr&)>& handler);
@@ -145,6 +148,8 @@ private:
 
        boost::mutex m_Mutex;
        boost::condition_variable m_CV;
+
+       bool m_Corked{false};
 };
 
 }