Browse Source

[1959] Receive packets from the server.

Marcin Siodelski 12 years ago
parent
commit
cc5e14f7a8
2 changed files with 20 additions and 1 deletions
  1. 18 1
      tests/tools/perfdhcp/test_control.cc
  2. 2 0
      tests/tools/perfdhcp/test_control.h

+ 18 - 1
tests/tools/perfdhcp/test_control.cc

@@ -252,7 +252,21 @@ TestControl::openSocket() const {
         isc_throw(BadValue, "unable to open socket to communicate with "
                   "DHCP server");
     }
-    return sock;
+    return(sock);
+}
+
+void
+TestControl::receivePackets() {
+    int timeout = 0;
+    bool receiving = true;
+    while (receiving) {
+        Pkt4Ptr pkt4 = IfaceMgr::instance().receive4(timeout);
+        if (!pkt4) {
+            receiving = false;
+        } else {
+            std::cout << "Received packet" << std::endl;
+        }
+    }
 }
 
 void
@@ -315,6 +329,9 @@ TestControl::run() {
             break;
         }
         uint64_t packets_due = getNextExchangesNum();
+
+        receivePackets();
+
         for (uint64_t i = packets_due; i > 0; --i) {
             startExchange(socket);
             ++packets_sent;

+ 2 - 0
tests/tools/perfdhcp/test_control.h

@@ -230,6 +230,8 @@ private:
     /// \return socket descriptor.
     int openSocket() const;
 
+    void receivePackets();
+
     /// \brief Register option factory functions for DHCPv4
     ///
     /// Method registers option factory functions for DHCPv4.