Commit 92e83eb2 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[5564] Changes after review:

 - dumpPackets renamed to discardPackets
 - added missing comments
parent 5b9b5e26
......@@ -460,7 +460,7 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t port, const bool use_bcast,
Dhcpv4Srv::~Dhcpv4Srv() {
// Discard any cached packets or parked packets
dumpPackets();
discardPackets();
try {
stopD2();
......@@ -3589,7 +3589,7 @@ int Dhcpv4Srv::getHookIndexLease4Decline() {
return (Hooks.hook_index_lease4_decline_);
}
void Dhcpv4Srv::dumpPackets() {
void Dhcpv4Srv::discardPackets() {
// Clear any packets held by the callhout handle store and
// all parked packets
isc::dhcp::Pkt4Ptr pkt4ptr_empty;
......
......@@ -331,7 +331,7 @@ public:
dhcp_ddns::NameChangeRequestPtr& ncr);
/// @brief Discard all in-progress packets
void dumpPackets();
void discardPackets();
protected:
......
......@@ -291,7 +291,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// Remove any existing timers.
if (!check_only) {
TimerMgr::instance()->unregisterTimers();
server.dumpPackets();
server.discardPackets();
}
// Revert any runtime option definitions configured so far and not committed.
......
......@@ -218,7 +218,7 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
}
Dhcpv6Srv::~Dhcpv6Srv() {
dumpPackets();
discardPackets();
try {
stopD2();
} catch(const std::exception& ex) {
......@@ -3762,11 +3762,11 @@ Dhcpv6Srv::requestedInORO(const Pkt6Ptr& query, const uint16_t code) const {
return (false);
}
void Dhcpv6Srv::dumpPackets() {
void Dhcpv6Srv::discardPackets() {
// Dump all of our current packets, anything that is mid-stream
isc::dhcp::Pkt6Ptr pkt6ptr_empty;
isc::dhcp::getCalloutHandle(pkt6ptr_empty);
ServerHooks::getServerHooks().getParkingLotsPtr()->clear();
HooksManager::clearParkingLots();
}
};
......
......@@ -174,10 +174,10 @@ public:
NameChangeSender::Result result,
dhcp_ddns::NameChangeRequestPtr& ncr);
/// @brief Dumps cached and parked packets
/// @brief Discards cached and parked packets
/// Clears the call_handle store and packet parking lots
/// of all packets. Called during reconfigure and shutdown.
void dumpPackets();
void discardPackets();
protected:
......
......@@ -389,7 +389,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
// Remove any existing timers.
if (!check_only) {
TimerMgr::instance()->unregisterTimers();
server.dumpPackets();
server.discardPackets();
}
// Revert any runtime option definitions configured so far and not committed.
......
......@@ -310,6 +310,11 @@ public:
getHooksManager().referenceInternal(hook_name, parked_object);
}
/// @brief Clears any parking packets.
///
/// This method should be called during reconfiguration to ensure there
/// are no dangling pointers that could possibly prevent the library
/// from being unloaded.
static void clearParkingLots() {
getHooksManager().clearParkingLotsInternal();
}
......@@ -371,6 +376,9 @@ private:
getParkingLotPtr(hook_name)->reference(parked_object);
}
/// @brief Clears all pointers stored in parking lots.
///
/// See @ref clearParkingLots for explanation.
void clearParkingLotsInternal() {
ServerHooks::getServerHooks().getParkingLotsPtr()->clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment