]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1369] Addressed review comments
authorThomas Markwalder <tmark@isc.org>
Tue, 11 Aug 2020 18:34:02 +0000 (14:34 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 12 Aug 2020 19:19:37 +0000 (15:19 -0400)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/lib/mysql/mysql_connection.cc
src/lib/pgsql/pgsql_connection.cc

index 16e48d87051adb8eb1292d74586d68ce615c835f..5741a94fd84d24097245a5b61c2cd0c3cda8a5d2 100644 (file)
@@ -1136,7 +1136,7 @@ void
 ControlledDhcpv4Srv::dbReconnect(ReconnectCtlPtr db_reconnect_ctl) {
     bool reopened = false;
 
-    // We lost at least one of them, Reopen all of them (lease, host, and CB databases)
+    // We lost at least one of them, Reopen all of them (lease, host, and CB databases).
     try {
         CfgDbAccessPtr cfg_db = CfgMgr::instance().getCurrentCfg()->getCfgDbAccess();
         cfg_db->createManagers();
@@ -1228,9 +1228,11 @@ ControlledDhcpv4Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg,
         server_->getCBControl()->databaseConfigFetch(srv_cfg,
                                                      CBControlDHCPv4::FetchMode::FETCH_UPDATE);
         (*failure_count) = 0;
+
     } catch (const std::exception& ex) {
         LOG_ERROR(dhcp4_logger, DHCP4_CB_PERIODIC_FETCH_UPDATES_FAIL)
             .arg(ex.what());
+
         // We allow at most 10 consecutive failures after which we stop
         // making further attempts to fetch the configuration updates.
         // Let's return without re-scheduling the timer.
index b8577c97da452be40ed4cc4bf76608fe39f9ab0f..c95dc0b5b4408536a409a6f7b9e0f915fca8f238 100644 (file)
@@ -299,7 +299,6 @@ MySqlConnection::getVersion(const ParameterMap& parameters) {
 
 void
 MySqlConnection::prepareStatement(uint32_t index, const char* text) {
-    checkUnusable();
     // Validate that there is space for the statement in the statements array
     // and that nothing has been placed there before.
     if ((index >= statements_.size()) || (statements_[index] != NULL)) {
@@ -326,7 +325,6 @@ MySqlConnection::prepareStatement(uint32_t index, const char* text) {
 void
 MySqlConnection::prepareStatements(const TaggedStatement* start_statement,
                                    const TaggedStatement* end_statement) {
-    checkUnusable();
     // Created the MySQL prepared statements for each DML statement.
     for (const TaggedStatement* tagged_statement = start_statement;
          tagged_statement != end_statement; ++tagged_statement) {
index 21a36f992fb8bfc9a18e28d6d88c82def8703e03..3b32f3d39c74b4b208ec7a722d6a734d5b2760d4 100644 (file)
@@ -363,6 +363,7 @@ PgSqlConnection::checkStatementError(const PgSqlResult& r,
 void
 PgSqlConnection::startTransaction() {
     DB_LOG_DEBUG(DB_DBG_TRACE_DETAIL, PGSQL_START_TRANSACTION);
+    checkUnusable();
     PgSqlResult r(PQexec(conn_, "START TRANSACTION"));
     if (PQresultStatus(r) != PGRES_COMMAND_OK) {
         const char* error_message = PQerrorMessage(conn_);
@@ -374,6 +375,7 @@ PgSqlConnection::startTransaction() {
 void
 PgSqlConnection::commit() {
     DB_LOG_DEBUG(DB_DBG_TRACE_DETAIL, PGSQL_COMMIT);
+    checkUnusable();
     PgSqlResult r(PQexec(conn_, "COMMIT"));
     if (PQresultStatus(r) != PGRES_COMMAND_OK) {
         const char* error_message = PQerrorMessage(conn_);
@@ -384,6 +386,7 @@ PgSqlConnection::commit() {
 void
 PgSqlConnection::rollback() {
     DB_LOG_DEBUG(DB_DBG_TRACE_DETAIL, PGSQL_ROLLBACK);
+    checkUnusable();
     PgSqlResult r(PQexec(conn_, "ROLLBACK"));
     if (PQresultStatus(r) != PGRES_COMMAND_OK) {
         const char* error_message = PQerrorMessage(conn_);