]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5315] Config Manager now returns non-const pointer to current config.
authorMarcin Siodelski <marcin@isc.org>
Mon, 24 Jul 2017 11:52:27 +0000 (13:52 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 15 Aug 2017 11:58:42 +0000 (13:58 +0200)
src/lib/dhcpsrv/cfgmgr.cc
src/lib/dhcpsrv/cfgmgr.h

index 201ae97e199e0b80a7d6c28ee8fb17ac88acc7e6..2896b8bc4a1fa1ce80800a1e077e450d91b6aebf 100644 (file)
@@ -150,7 +150,7 @@ CfgMgr::revert(const size_t index) {
     commit();
 }
 
-ConstSrvConfigPtr
+SrvConfigPtr
 CfgMgr::getCurrentCfg() {
     ensureCurrentAllocated();
     return (configuration_);
index bf0c6e459002ff7c51d83d28a310c37bef5b6ed1..2afccb15b80aeef34b6b4e2af392d93feeeb6e1b 100644 (file)
@@ -196,10 +196,26 @@ public:
     ///
     /// This function returns pointer to the current configuration. If the
     /// current configuration is not set it will create a default configuration
-    /// and return it. Current configuration returned is read-only.
-    ///
-    /// @return Non-null const pointer to the current configuration.
-    ConstSrvConfigPtr getCurrentCfg();
+    /// and return it.
+    ///
+    /// In the previous Kea releases this method used to return a const pointer
+    /// to the current configuration to ensure that it is not accidentally
+    /// modified while the server is running. This has been changed in Kea 1.3
+    /// release and now this function returns a non-const pointer. The reason
+    /// is that there are certain use cases when current configuration must
+    /// be modified without going through a full cycle of server
+    /// reconfiguration, e.g. add a subnet to the current configuration as
+    /// a result of receiving a command over control API. In such case the
+    /// performance of processing such command is critical and rebuilding the
+    /// whole configuration just for this small configuration change is out
+    /// of question.
+    ///
+    /// Nevertheless, such configuration updates should always be made with
+    /// caution and one has to make sure that the configuration data integrity
+    /// is preserved.
+    ///
+    /// @return Non-null pointer to the current configuration.
+    SrvConfigPtr getCurrentCfg();
 
     /// @brief Returns a pointer to the staging configuration.
     ///