Browse Source

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

Marcin Siodelski 11 years ago
parent
commit
42d8288e57
4 changed files with 26 additions and 3 deletions
  1. 12 0
      src/bin/dhcp4/dhcp4_srv.cc
  2. 11 0
      src/bin/dhcp4/dhcp4_srv.h
  3. 2 2
      src/bin/dhcp6/dhcp6_srv.cc
  4. 1 1
      src/bin/dhcp6/dhcp6_srv.h

+ 12 - 0
src/bin/dhcp4/dhcp4_srv.cc

@@ -456,6 +456,9 @@ Dhcpv4Srv::run() {
             LOG_ERROR(dhcp4_logger, DHCP4_PACKET_SEND_FAIL)
                 .arg(e.what());
         }
+
+        // Send NameChangeRequests to the b10-dhcp_ddns module.
+        sendNameChangeRequests();
     }
 
     return (true);
@@ -965,6 +968,15 @@ queueNameChangeRequest(const isc::dhcp_ddns::NameChangeType chg_type,
     name_change_reqs_.push(ncr);
 }
 
+void
+Dhcpv4Srv::sendNameChangeRequests() {
+    while (!name_change_reqs_.empty()) {
+        // @todo Once next NameChangeRequest is picked from the queue
+        // we should send it to the b10-dhcp_ddns module. Currently we
+        // just drop it.
+        name_change_reqs_.pop();
+    }
+}
 
 void
 Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {

+ 11 - 0
src/bin/dhcp4/dhcp4_srv.h

@@ -346,6 +346,17 @@ protected:
     void queueNameChangeRequest(const isc::dhcp_ddns::NameChangeType chg_type,
                                 const Lease4Ptr& lease);
 
+    /// @brief Sends all outstanding NameChangeRequests to b10-dhcp-ddns module.
+    ///
+    /// The purpose of this function is to pick all outstanding
+    /// NameChangeRequests from the FIFO queue and send them to b10-dhcp-ddns
+    /// 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
     ///
     /// Attempts to renew existing lease. This typically includes finding a lease that

+ 2 - 2
src/bin/dhcp6/dhcp6_srv.cc

@@ -458,7 +458,7 @@ bool Dhcpv6Srv::run() {
                     .arg(e.what());
             }
 
-            // Send NameChangeRequests to the b10-dhcp_ddns module.
+            // Send NameChangeRequests to the b10-dhcp-ddns module.
             sendNameChangeRequests();
         }
     }
@@ -1138,7 +1138,7 @@ void
 Dhcpv6Srv::sendNameChangeRequests() {
     while (!name_change_reqs_.empty()) {
         // @todo Once next NameChangeRequest is picked from the queue
-        // we should send it to the bind10-dhcp_ddns module. Currently we
+        // we should send it to the b10-dhcp_ddns module. Currently we
         // just drop it.
         name_change_reqs_.pop();
     }

+ 1 - 1
src/bin/dhcp6/dhcp6_srv.h

@@ -378,7 +378,7 @@ protected:
     /// @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-dhcp-ddns
+    /// NameChangeRequests from the FIFO queue and send them to b10-dhcp-ddns
     /// module.
     ///
     /// @todo Currently this function simply removes all requests from the