From: Marcin Siodelski Date: Wed, 26 Sep 2012 10:38:23 +0000 (+0200) Subject: [2187] Catch exceptions in perfdhcp if packet reception failed. X-Git-Tag: trac2351_base~37^2~3^2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbf34f3ba16d91fabcfa53a5b989e999d9c19875;p=thirdparty%2Fkea.git [2187] Catch exceptions in perfdhcp if packet reception failed. --- diff --git a/tests/tools/perfdhcp/test_control.cc b/tests/tools/perfdhcp/test_control.cc index c154cf9ceb..55a3c3c464 100644 --- a/tests/tools/perfdhcp/test_control.cc +++ b/tests/tools/perfdhcp/test_control.cc @@ -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 {