Howtos/NewPacket: Small fixes
[senf.git] / Socket / SocketProtocol.test.hh
index f1459fe..68a6466 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institute for Open Communication Systems (FOKUS) 
-// Competence Center NETwork research (NET), St. Augustin, GERMANY 
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -40,13 +40,23 @@ namespace test {
     public:
         ~SomeProtocol() {}
 
-        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;
+        }
     };
 
 }}