Packets: Fix VariantParser invalid parser access bug
[senf.git] / Socket / SocketProtocol.test.hh
index 3ca682a..497cff1 100644 (file)
@@ -20,8 +20,8 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#ifndef HH_SocketProtocol_test_
-#define HH_SocketProtocol_test_ 1
+#ifndef HH_SENF_Socket_SocketProtocol_test_
+#define HH_SENF_Socket_SocketProtocol_test_ 1
 
 // Custom includes
 #include "SocketProtocol.hh"
 namespace senf {
 namespace test {
 
-    class SomeProtocol
-        : public ConcreteSocketProtocol<SomeSocketPolicy,SomeProtocol>
+    class SomeSocketProtocol
+        : public ConcreteSocketProtocol<SomeSocketPolicy,SomeSocketProtocol>
     {
     public:
-        ~SomeProtocol() {}
+        ~SomeSocketProtocol() {}
 
-        void init_client() const {}
-        void init_server() const {}
+        void init_client() const { fd(0); }
+        void init_server() const { fd(0); }
 
         unsigned available() const
             { return Policy::ReadPolicy::TEST_SIZE; }
         bool eof() const
             { return false; }
+
+        virtual void close() const {
+            closeCount(1);
+        }
+
+        static unsigned closeCount(unsigned inc=0) {
+            static unsigned counter (0);
+            counter += inc;
+            return counter;
+        }
     };
 
 }}