Browse Source

[3036] Remove outstanding NameChangeRequests from the queue when idle.

Marcin Siodelski 11 years ago
parent
commit
2babc7e393
2 changed files with 26 additions and 0 deletions
  1. 15 0
      src/bin/dhcp6/dhcp6_srv.cc
  2. 11 0
      src/bin/dhcp6/dhcp6_srv.h

+ 15 - 0
src/bin/dhcp6/dhcp6_srv.cc

@@ -277,6 +277,11 @@ bool Dhcpv6Srv::run() {
                     LOG_ERROR(dhcp6_logger, DHCP6_PACK_FAIL);
                 }
             }
+
+            // Although we don't support sending the NameChangeRequests to
+            // bind10-d2 module, we already call sendNameChangeRequets() here
+            // to empty the queue. Otherwise, the queue would bloat.
+            sendNameChangeRequests();
         }
     }
 
@@ -914,6 +919,16 @@ Dhcpv6Srv::createRemovalNameChangeRequest(const Lease6Ptr& lease) {
 
 }
 
+void
+Dhcpv6Srv::sendNameChangeRequests() {
+    while (!name_change_reqs_.empty()) {
+        // @todo Once next NameChangeRequest is picked from the queue
+        // we should send it to the bind10-d2 module. Currently we
+        // just drop it.
+        name_change_reqs_.pop();
+    }
+}
+
 
 OptionPtr
 Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,

+ 11 - 0
src/bin/dhcp6/dhcp6_srv.h

@@ -344,6 +344,17 @@ protected:
     /// records will be performed.
     void createRemovalNameChangeRequest(const Lease6Ptr& lease);
 
+    /// @brief Sends all outstanding NameChangeRequests to bind10-d2 module.
+    ///
+    /// The purpose of this function is to pick all outstanding
+    /// NameChangeRequests from the FIFO queue and send them to bind10-d2
+    /// module.
+    ///
+    /// @todo Currently this function simply removes all requests from the
+    /// queue but doesn't send them anywhere. In the future, the
+    /// NameChangeSender will be used to deliver requests to the other module.
+    void sendNameChangeRequests();
+
     /// @brief Attempts to renew received addresses
     ///
     /// It iterates through received IA_NA options and attempts to renew