From 87a15e844a0a0cfac46b4daca31869b8834826d8 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Thu, 8 Nov 2018 14:22:05 +0100 Subject: [PATCH] [#42, !103] Addressed two review comments. Commentary for sleep(1) in case of the error condition in the IfaceMgr. Also fixed one parameter name in the doxygen. --- src/lib/dhcp/iface_mgr.cc | 6 ++++++ src/lib/dhcp/packet_queue.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 044fbb6081..8792b216e6 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -1221,6 +1221,9 @@ void IfaceMgr::receiveDHCP4Packets() { // Signal the error to receive4. receiver_error_ = strerror(errno); error_watch_.markReady(); + // We need to sleep in case of the error condition to + // prevent the thread from tight looping when result + // gets negative. sleep(1); } continue; @@ -1303,6 +1306,9 @@ void IfaceMgr::receiveDHCP6Packets() { // Signal the error to receive6. receiver_error_ = strerror(errno); error_watch_.markReady(); + // We need to sleep in case of the error condition to + // prevent the thread from tight looping when result + // gets negative. sleep(1); } continue; diff --git a/src/lib/dhcp/packet_queue.h b/src/lib/dhcp/packet_queue.h index 32e2c4a95c..0d33a4ef26 100644 --- a/src/lib/dhcp/packet_queue.h +++ b/src/lib/dhcp/packet_queue.h @@ -234,7 +234,7 @@ public: /// @brief Constructor /// /// @param queue_type logical name of the queue implementation - /// @param queue_capacity maximum number of packets the queue can hold + /// @param capacity maximum number of packets the queue can hold PacketQueueRing(const std::string& queue_type, size_t capacity) : PacketQueue(queue_type) { queue_.set_capacity(capacity); -- 2.47.2