Commit e72dbcab authored by Razvan Becheriu's avatar Razvan Becheriu

[1040] reverted minor changes

parent ff6d2cf3
......@@ -232,8 +232,6 @@ CqlConnection::openDatabase() {
try {
port_number = boost::lexical_cast<int32_t>(port);
if (port_number < 1 || port_number > 65535) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): "
"port outside of range, expected "
......@@ -241,8 +239,6 @@ CqlConnection::openDatabase() {
<< port);
}
} catch (const boost::bad_lexical_cast& ex) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): invalid "
"port, expected castable to int, instead got "
......@@ -269,16 +265,12 @@ CqlConnection::openDatabase() {
reconnect_wait_time_number =
boost::lexical_cast<int32_t>(reconnect_wait_time);
if (reconnect_wait_time_number < 0) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): invalid reconnect "
"wait time, expected positive number, instead got "
<< reconnect_wait_time);
}
} catch (const boost::bad_lexical_cast& ex) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): "
"invalid reconnect wait time, expected "
......@@ -295,8 +287,6 @@ CqlConnection::openDatabase() {
connect_timeout_number =
boost::lexical_cast<int32_t>(connect_timeout);
if (connect_timeout_number < 0) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): "
"invalid connect timeout, expected "
......@@ -304,8 +294,6 @@ CqlConnection::openDatabase() {
<< connect_timeout);
}
} catch (const boost::bad_lexical_cast& ex) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): invalid connect timeout, "
"expected castable to int, instead got \""
......@@ -320,8 +308,6 @@ CqlConnection::openDatabase() {
request_timeout_number =
boost::lexical_cast<int32_t>(request_timeout);
if (request_timeout_number < 0) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): "
"invalid request timeout, expected "
......@@ -329,8 +315,6 @@ CqlConnection::openDatabase() {
<< request_timeout);
}
} catch (const boost::bad_lexical_cast& ex) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): invalid request timeout, "
"expected castable to int, instead got \""
......@@ -344,8 +328,6 @@ CqlConnection::openDatabase() {
try {
tcp_keepalive_number = boost::lexical_cast<int32_t>(tcp_keepalive);
if (tcp_keepalive_number < 0) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): "
"invalid TCP keepalive, expected "
......@@ -353,8 +335,6 @@ CqlConnection::openDatabase() {
<< tcp_keepalive);
}
} catch (const boost::bad_lexical_cast& ex) {
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOperationError,
"CqlConnection::openDatabase(): invalid TCP keepalive, "
"expected castable to int, instead got \""
......@@ -391,10 +371,6 @@ CqlConnection::openDatabase() {
schema_meta_ = cass_session_get_schema_meta(session_);
keyspace_meta_ = cass_schema_meta_keyspace_by_name(schema_meta_, keyspace);
if (!keyspace_meta_) {
cass_session_free(session_);
session_ = NULL;
cass_cluster_free(cluster_);
cluster_ = NULL;
isc_throw(DbOpenError, "CqlConnection::openDatabase(): "
"!cass_schema_meta_keyspace_by_name()");
}
......
......@@ -26,7 +26,6 @@
#include <dhcp/hwaddr.h>
#include <asiolink/io_address.h>
#include <boost/make_shared.hpp>
using namespace isc::data;
using namespace isc::db;
......@@ -719,7 +718,7 @@ CqlLease4Exchange::retrieve() {
time_t cltt = 0;
CqlExchange::convertFromDatabaseTime(expire_, valid_lifetime_, cltt);
HWAddrPtr hwaddr = boost::make_shared<HWAddr>(hwaddr_, HTYPE_ETHER);
HWAddrPtr hwaddr(new HWAddr(hwaddr_, HTYPE_ETHER));
uint32_t addr4 = static_cast<uint32_t>(address_);
......@@ -732,10 +731,10 @@ CqlLease4Exchange::retrieve() {
}
}
Lease4Ptr result(boost::make_shared<Lease4>(addr4, hwaddr, client_id_.data(),
client_id_.size(), valid_lifetime_,
cltt, subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_));
Lease4Ptr result(new Lease4(addr4, hwaddr, client_id_.data(),
client_id_.size(), valid_lifetime_,
cltt, subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_));
result->state_ = state_;
......@@ -797,8 +796,8 @@ CqlLease4Exchange::getExpiredLeases(const size_t &max_leases,
cass_int32_t limit = max_leases > 0u ? static_cast<cass_int32_t>(max_leases) :
std::numeric_limits<cass_int32_t>::max();
for (cass_int32_t state = Lease::STATE_DEFAULT; state <= Lease::STATE_EXPIRED_RECLAIMED;
++state) {
for (cass_int32_t state = Lease::STATE_DEFAULT;
state <= Lease::STATE_EXPIRED_RECLAIMED; ++state) {
if (state == keep_state) {
continue;
}
......@@ -810,7 +809,8 @@ CqlLease4Exchange::getExpiredLeases(const size_t &max_leases,
// Retrieve leases from the database.
Lease4Collection temp_collection;
getLeaseCollection(CqlLease4Exchange::GET_LEASE4_EXPIRE, data, temp_collection);
getLeaseCollection(CqlLease4Exchange::GET_LEASE4_EXPIRE, data,
temp_collection);
for (Lease4Ptr &lease : temp_collection) {
expired_leases.push_back(lease);
......@@ -1527,11 +1527,11 @@ CqlLease6Exchange::retrieve() {
IOAddress addr(address_);
DuidPtr duid(boost::make_shared<DUID>(duid_));
DuidPtr duid(new DUID(duid_));
HWAddrPtr hwaddr;
if (hwaddr_.size()) {
hwaddr = boost::make_shared<HWAddr>(hwaddr_, hwtype_);
hwaddr.reset(new HWAddr(hwaddr_, hwtype_));
hwaddr->source_ = hwaddr_source_;
}
......@@ -1546,10 +1546,10 @@ CqlLease6Exchange::retrieve() {
// Create the lease and set the cltt (after converting from the
// expire time retrieved from the database).
Lease6Ptr result(boost::make_shared<Lease6>(static_cast<Lease::Type>(lease_type_), addr, duid,
iaid_, pref_lifetime_, valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_, hostname_,
hwaddr, prefix_len_));
Lease6Ptr result(new Lease6(static_cast<Lease::Type>(lease_type_), addr, duid,
iaid_, pref_lifetime_, valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_, hostname_,
hwaddr, prefix_len_));
time_t cltt = 0;
CqlExchange::convertFromDatabaseTime(expire_, valid_lifetime_, cltt);
......@@ -1616,8 +1616,8 @@ CqlLease6Exchange::getExpiredLeases(const size_t &max_leases,
cass_int32_t limit = max_leases > 0u ? static_cast<cass_int32_t>(max_leases) :
std::numeric_limits<cass_int32_t>::max();
for (cass_int32_t state = Lease::STATE_DEFAULT; state <= Lease::STATE_EXPIRED_RECLAIMED;
++state) {
for (cass_int32_t state = Lease::STATE_DEFAULT;
state <= Lease::STATE_EXPIRED_RECLAIMED; ++state) {
if (state == keep_state) {
continue;
}
......@@ -1629,7 +1629,8 @@ CqlLease6Exchange::getExpiredLeases(const size_t &max_leases,
// Retrieve leases from the database.
Lease6Collection temp_collection;
getLeaseCollection(CqlLease6Exchange::GET_LEASE6_EXPIRE, data, temp_collection);
getLeaseCollection(CqlLease6Exchange::GET_LEASE6_EXPIRE, data,
temp_collection);
for (Lease6Ptr &lease : temp_collection) {
expired_leases.push_back(lease);
......
......@@ -15,7 +15,6 @@
#include <util/multi_threading_mgr.h>
#include <boost/array.hpp>
#include <boost/make_shared.hpp>
#include <boost/static_assert.hpp>
#include <mysqld_error.h>
......@@ -812,9 +811,9 @@ public:
}
}
Lease4Ptr lease(boost::make_shared<Lease4>(addr4_, hwaddr, client_id_buffer_,
client_id_length_, valid_lifetime_, cltt,
subnet_id_, fqdn_fwd_, fqdn_rev_, hostname));
Lease4Ptr lease(new Lease4(addr4_, hwaddr, client_id_buffer_,
client_id_length_, valid_lifetime_, cltt,
subnet_id_, fqdn_fwd_, fqdn_rev_, hostname));
// Set state.
lease->state_ = state_;
......@@ -1416,10 +1415,10 @@ public:
// Create the lease and set the cltt (after converting from the
// expire time retrieved from the database).
Lease6Ptr result(boost::make_shared<Lease6>(type, addr, duid_ptr, iaid_,
pref_lifetime_, valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname, hwaddr, prefixlen_));
Lease6Ptr result(new Lease6(type, addr, duid_ptr, iaid_,
pref_lifetime_, valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname, hwaddr, prefixlen_));
time_t cltt = 0;
// Recover from overflow
uint32_t valid_lft = valid_lifetime_;
......
......@@ -14,7 +14,6 @@
#include <dhcpsrv/pgsql_lease_mgr.h>
#include <util/multi_threading_mgr.h>
#include <boost/make_shared.hpp>
#include <boost/static_assert.hpp>
#include <iomanip>
......@@ -584,12 +583,12 @@ public:
}
}
Lease4Ptr result(boost::make_shared<Lease4>(addr4_, hwaddr,
client_id_buffer_,
client_id_length_,
valid_lifetime_, cltt_,
subnet_id_, fqdn_fwd_,
fqdn_rev_, hostname_));
Lease4Ptr result(new Lease4(addr4_, hwaddr,
client_id_buffer_,
client_id_length_,
valid_lifetime_, cltt_,
subnet_id_, fqdn_fwd_,
fqdn_rev_, hostname_));
result->state_ = state;
......@@ -901,14 +900,11 @@ public:
}
}
Lease6Ptr result(boost::make_shared<Lease6>(lease_type_, addr,
duid_ptr,
iaid_u_.uval_,
pref_lifetime_,
valid_lifetime_,
subnet_id_, fqdn_fwd_,
fqdn_rev_, hostname_,
hwaddr, prefix_len_));
Lease6Ptr result(new Lease6(lease_type_, addr, duid_ptr,
iaid_u_.uval_, pref_lifetime_,
valid_lifetime_,
subnet_id_, fqdn_fwd_, fqdn_rev_,
hostname_, hwaddr, prefix_len_));
result->cltt_ = cltt_;
result->state_ = state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment