Browse Source

[2559] Add debug message when database is closed

Stephen Morris 12 years ago
parent
commit
f4e272c729
2 changed files with 13 additions and 0 deletions
  1. 7 0
      src/lib/dhcpsrv/dhcpsrv_messages.mes
  2. 6 0
      src/lib/dhcpsrv/lease_mgr_factory.cc

+ 7 - 0
src/lib/dhcpsrv/dhcpsrv_messages.mes

@@ -60,6 +60,13 @@ This is a debug message reporting that the DHCP configuration manager has
 returned the specified IPv6 subnet when given the address hint specified
 returned the specified IPv6 subnet when given the address hint specified
 as the address is within the subnet.
 as the address is within the subnet.
 
 
+% DHCPSRV_CLOSE_DB closing currently open %1 database
+This is a debug message, issues when the DHCP server closed the currently
+open lease database.  It is issued at program shutdown, and whenever
+the database access parameters are changed: in the latter case, the
+server closes the currently open database, and opens a database using
+the new parameters.
+
 % DHCPSRV_INVALID_ACCESS invalid database access string: %1
 % DHCPSRV_INVALID_ACCESS invalid database access string: %1
 This is logged when an attempt has been made to parse a database access string
 This is logged when an attempt has been made to parse a database access string
 and the attempt ended in error.  The access string in question - which
 and the attempt ended in error.  The access string in question - which

+ 6 - 0
src/lib/dhcpsrv/lease_mgr_factory.cc

@@ -141,6 +141,12 @@ LeaseMgrFactory::create(const std::string& dbaccess) {
 
 
 void
 void
 LeaseMgrFactory::destroy() {
 LeaseMgrFactory::destroy() {
+    // Destroy current lease manager.  This is a no-op if no lease manager
+    // is available.
+    if (getLeaseMgrPtr()) {
+        LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CLOSE_DB)
+            .arg(getLeaseMgrPtr()->getType());
+    }
     getLeaseMgrPtr().reset();
     getLeaseMgrPtr().reset();
 }
 }