Commit c9094a92 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5305] Use weak pointer to reference a network from subnet.

parent 47215e37
......@@ -12,6 +12,7 @@
#include <dhcpsrv/cfg_option.h>
#include <dhcpsrv/cfg_4o6.h>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <string>
namespace isc {
......@@ -95,6 +96,9 @@ protected:
/// @brief Pointer to the @ref Network object.
typedef boost::shared_ptr<Network> NetworkPtr;
/// @brief Weak pointer to the @ref Network object.
typedef boost::weak_ptr<Network> WeakNetworkPtr;
} // end of namespace isc::dhcp
} // end of namespace isc
......
......@@ -352,7 +352,7 @@ public:
template<typename SharedNetworkPtrType>
void getSharedNetwork(SharedNetworkPtrType& shared_network) const {
shared_network = boost::dynamic_pointer_cast<
typename SharedNetworkPtrType::element_type>(shared_network_);
typename SharedNetworkPtrType::element_type>(shared_network_.lock());
}
private:
......@@ -538,7 +538,8 @@ protected:
/// See @ref HRMode type for details.
HRMode host_reservation_mode_;
NetworkPtr shared_network_;
/// @brief Pointer to a shared network that subnet belongs to.
WeakNetworkPtr shared_network_;
};
/// @brief A generic pointer to either Subnet4 or Subnet6 object
......
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