From: Marcin Siodelski Date: Thu, 4 Jul 2019 19:45:37 +0000 (+0200) Subject: [#714,!409] Addressed review comments. X-Git-Tag: Kea-1.6.0-beta2~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce12d980d24763d78802abd1a2555b8eccbd6365;p=thirdparty%2Fkea.git [#714,!409] Addressed review comments. Removed unnecessary queries before create/update. --- diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index 162fe07a61..3a57105e5c 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -1449,9 +1449,6 @@ public: }; MySqlTransaction transaction(conn_); - OptionDescriptorPtr existing_option = - getOption(GET_OPTION4_CODE_SPACE, Option::V4, server_selector, - option->option_->getType(), option->space_name_); // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. @@ -1517,12 +1514,6 @@ public: transaction.reset(new MySqlTransaction(conn_)); } - OptionDescriptorPtr existing_option = - getOption(GET_OPTION4_SUBNET_ID_CODE_SPACE, Option::V4, - server_selector, subnet_id, - option->option_->getType(), - option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. ScopedAuditRevision @@ -1607,11 +1598,6 @@ public: MySqlTransaction transaction(conn_); - OptionDescriptorPtr existing_option = - getOption(GET_OPTION4_POOL_ID_CODE_SPACE, - server_selector, Lease::TYPE_V4, pool_id, - option->option_->getType(), option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. ScopedAuditRevision @@ -1678,11 +1664,6 @@ public: transaction.reset(new MySqlTransaction(conn_)); } - OptionDescriptorPtr existing_option = - getOption(GET_OPTION4_SHARED_NETWORK_CODE_SPACE, Option::V4, - server_selector, shared_network_name, - option->option_->getType(), option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. ScopedAuditRevision diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc index fa46affb10..94a4537d4f 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc @@ -1661,9 +1661,6 @@ public: }; MySqlTransaction transaction(conn_); - OptionDescriptorPtr existing_option = - getOption(GET_OPTION6_CODE_SPACE, Option::V6, server_selector, - option->option_->getType(), option->space_name_); // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. @@ -1730,12 +1727,6 @@ public: transaction.reset(new MySqlTransaction(conn_)); } - OptionDescriptorPtr existing_option = - getOption(GET_OPTION6_SUBNET_ID_CODE_SPACE, Option::V6, - server_selector, subnet_id, - option->option_->getType(), - option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. ScopedAuditRevision @@ -1885,13 +1876,6 @@ public: MySqlTransaction transaction(conn_); - int index = (pool_type == Lease::TYPE_NA ? - GET_OPTION6_POOL_ID_CODE_SPACE : - GET_OPTION6_PD_POOL_ID_CODE_SPACE); - OptionDescriptorPtr existing_option = - getOption(index, server_selector, pool_type, pool_id, - option->option_->getType(), option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. if (pool_type == Lease::TYPE_PD) { @@ -1905,9 +1889,9 @@ public: MySqlConfigBackendDHCPv6Impl::CREATE_AUDIT_REVISION, server_selector, msg, cascade_update); - index = (pool_type == Lease::TYPE_NA ? - MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_POOL_ID : - MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_PD_POOL_ID); + auto index = (pool_type == Lease::TYPE_NA ? + MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_POOL_ID : + MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_PD_POOL_ID); if (conn_.updateDeleteQuery(index, in_bindings) == 0) { // Remove the 4 bindings used only in case of update. in_bindings.resize(in_bindings.size() - 4); @@ -1966,11 +1950,6 @@ public: transaction.reset(new MySqlTransaction(conn_)); } - OptionDescriptorPtr existing_option = - getOption(GET_OPTION6_SHARED_NETWORK_CODE_SPACE, Option::V6, - server_selector, shared_network_name, - option->option_->getType(), option->space_name_); - // Create scoped audit revision. As long as this instance exists // no new audit revisions are created in any subsequent calls. ScopedAuditRevision