]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2187] Catch exceptions in perfdhcp if packet reception failed.
authorMarcin Siodelski <marcin@isc.org>
Wed, 26 Sep 2012 10:38:23 +0000 (12:38 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 26 Sep 2012 10:38:23 +0000 (12:38 +0200)
tests/tools/perfdhcp/test_control.cc

index c154cf9cebcbc66a315350638ec40bf0631bac27..55a3c3c464907b669b542711a2b8e7af0182c041 100644 (file)
@@ -784,7 +784,13 @@ TestControl::receivePackets(const TestControlSocket& socket) {
     uint64_t received = 0;
     while (receiving) {
         if (CommandOptions::instance().getIpVersion() == 4) {
-            Pkt4Ptr pkt4 = IfaceMgr::instance().receive4(timeout);
+            Pkt4Ptr pkt4;
+            try {
+                pkt4 = IfaceMgr::instance().receive4(timeout);
+            } catch (const Exception& e) {
+                std::cout << "Failed to receive DHCPv4 packet: "
+                          << e.what() <<  std::endl;
+            }
             if (!pkt4) {
                 receiving = false;
             } else {
@@ -796,7 +802,13 @@ TestControl::receivePackets(const TestControlSocket& socket) {
                 processReceivedPacket4(socket, pkt4);
             }
         } else if (CommandOptions::instance().getIpVersion() == 6) {
-            Pkt6Ptr pkt6 = IfaceMgr::instance().receive6(timeout);
+            Pkt6Ptr pkt6;
+            try {
+                pkt6 = IfaceMgr::instance().receive6(timeout);
+            } catch (const Exception& e) {
+                std::cout << "Failed to receive DHCPv6 packet: "
+                          << e.what() << std::endl;
+            }
             if (!pkt6) {
                 receiving  = false;
             } else {