CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
cfg_db->setAppendedParameters("universe=4");
- cfg_db->createManagers(server_->io_service_);
+ cfg_db->createManagers(server_->getIOService());
} catch (const std::exception& ex) {
err << "Unable to open database: " << ex.what();
return (isc::config::createAnswer(1, err.str()));
ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_PORT*/,
uint16_t client_port /*= 0*/)
- : Dhcpv4Srv(server_port, client_port), io_service_(boost::make_shared<IOService>()),
- timer_mgr_(TimerMgr::instance()) {
+ : Dhcpv4Srv(server_port, client_port), timer_mgr_(TimerMgr::instance()) {
if (getInstance()) {
isc_throw(InvalidOperation,
"There is another Dhcpv4Srv instance already.");
void ControlledDhcpv4Srv::shutdownServer(int exit_value) {
setExitValue(exit_value);
- io_service_->stop(); // Stop ASIO transmissions
+ getIOService()->stop(); // Stop ASIO transmissions
shutdown(); // Initiate DHCPv4 shutdown procedure.
}
// at this stage anyway.
}
-void ControlledDhcpv4Srv::sessionReader(void) {
- // Process one asio event. If there are more events, iface_mgr will call
- // this callback more than once.
- if (getInstance()) {
- getInstance()->io_service_->run_one();
- }
-}
-
void
ControlledDhcpv4Srv::reclaimExpiredLeases(const size_t max_leases,
const uint16_t timeout,
/// the server. Some of them need to be static methods.
static ControlledDhcpv4Srv* server_;
- /// @brief IOService object, used for all ASIO operations.
- isc::asiolink::IOServicePtr io_service_;
-
/// @brief Instance of the @c TimerMgr.
///
/// Shared pointer to the instance of timer @c TimerMgr is held here to
CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
cfg_db->setAppendedParameters("universe=6");
- cfg_db->createManagers(server_->io_service_);
+ cfg_db->createManagers(server_->getIOService());
} catch (const std::exception& ex) {
err << "Unable to open database: " << ex.what();
return (isc::config::createAnswer(1, err.str()));
ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port,
uint16_t client_port)
- : Dhcpv6Srv(server_port, client_port), io_service_(boost::make_shared<IOService>()),
- timer_mgr_(TimerMgr::instance()) {
+ : Dhcpv6Srv(server_port, client_port), timer_mgr_(TimerMgr::instance()) {
if (getInstance()) {
isc_throw(InvalidOperation,
"There is another Dhcpv6Srv instance already.");
void ControlledDhcpv6Srv::shutdownServer(int exit_value) {
setExitValue(exit_value);
- io_service_->stop(); // Stop ASIO transmissions
- shutdown(); // Initiate DHCPv6 shutdown procedure.
+ getIOService()->stop(); // Stop ASIO transmissions
+ shutdown(); // Initiate DHCPv6 shutdown procedure.
}
ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
// at this stage anyway.
}
-void ControlledDhcpv6Srv::sessionReader(void) {
- // Process one asio event. If there are more events, iface_mgr will call
- // this callback more than once.
- if (getInstance()) {
- getInstance()->io_service_->run_one();
- }
-}
-
void
ControlledDhcpv6Srv::reclaimExpiredLeases(const size_t max_leases,
const uint16_t timeout,
/// the server. Some of them need to be static methods.
static ControlledDhcpv6Srv* server_;
- /// @brief IOService object, used for all ASIO operations.
- isc::asiolink::IOServicePtr io_service_;
-
/// @brief Instance of the @c TimerMgr.
///
/// Shared pointer to the instance of timer @c TimerMgr is held here to
// Wasn't specified so we'll use default of 0;
}
- reconnect_ctl_ = boost::make_shared<ReconnectCtl>(timer_name, type, retries,
+ reconnect_ctl_ = boost::make_shared<ReconnectCtl>(type, timer_name, retries,
interval);
}
ASSERT_EQ(3, db_reconnect_ctl_->maxRetries());
ASSERT_EQ(3, db_reconnect_ctl_->retriesLeft());
EXPECT_EQ(60000, db_reconnect_ctl_->retryInterval());
- ASSERT_TRUE(db_reconnect_ctl_->checkRetries());
/// Verify that checkRetries() correctly decrements
/// down to zero, and that retriesLeft() returns
ASSERT_EQ(3, db_reconnect_ctl_->maxRetries());
ASSERT_EQ(3, db_reconnect_ctl_->retriesLeft());
EXPECT_EQ(60000, db_reconnect_ctl_->retryInterval());
- ASSERT_TRUE(db_reconnect_ctl_->checkRetries());
/// Verify that checkRetries() correctly decrements
/// down to zero, and that retriesLeft() returns
virtual std::string invalidConnectString() {
return (connectionString(MYSQL_VALID_TYPE, INVALID_NAME, VALID_HOST,
- VALID_USER, VALID_PASSWORD));
+ VALID_USER, VALID_PASSWORD));
}
};
virtual std::string invalidConnectString() {
return (connectionString(PGSQL_VALID_TYPE, VALID_NAME, INVALID_HOST,
- VALID_USER, VALID_PASSWORD));
+ VALID_USER, VALID_PASSWORD));
}
};
///
/// @note The recover function must be run on the IO Service thread.
void startRecoverDbConnection() {
- if (callback_) {
+ if (callback_ && io_service_) {
io_service_->post(std::bind(callback_, reconnectCtl()));
}
}
///
/// @note The recover function must be run on the IO Service thread.
void startRecoverDbConnection() {
- if (callback_) {
+ if (callback_ && io_service_) {
io_service_->post(std::bind(callback_, reconnectCtl()));
}
}