added a flush() member to ActiveBurstSocketSource
mtk [Wed, 19 Oct 2011 19:13:58 +0000 (19:13 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1817 270642c3-0616-0410-b53a-bc976706d245

senf/PPI/SocketSource.ct
senf/PPI/SocketSource.hh

index 00f5564..946515b 100644 (file)
@@ -143,6 +143,20 @@ prefix_ void senf::ppi::module::ActiveBurstSocketSource<Reader>::read()
     }
 }
 
+template <class Reader>
+prefix_ void senf::ppi::module::ActiveBurstSocketSource<Reader>::flush()
+{
+    try{
+        while( true){
+            typename Reader::PacketType p(reader_(handle_));
+            if (p.data().size() <= 0)
+                break;
+        }
+    }
+    catch(...){};
+}
+
+
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
 #undef prefix_
 
index 51ffa01..8ef7b99 100644 (file)
@@ -146,6 +146,7 @@ namespace module {
                                         ///< Set handle
                                         /**< Assigning an empty or in-valid() handle will disable
                                              the module until a new, valid handle is assigned. */
+
     private:
         Handle handle_;
         IOEvent event_;
@@ -182,6 +183,8 @@ namespace module {
         unsigned maxBurst() const;
         void maxBurst(unsigned max_burst);
 
+        void flush();
+
     private:
         Handle handle_;
         IOEvent event_;