// is no need to rollback configuration if socket fails to open on any
// of the interfaces.
CfgMgr::instance().getStagingCfg()->getCfgIface()->
- openSockets(AF_INET, srv->getServerPort(),
+ openSockets(AF_INET, srv->getServerPort(), srv->serverLock(),
getInstance()->useBroadcast());
// Install the timers for handling leases reclamation.
while (!shutdown_) {
try {
run_one();
- getIOService()->poll();
+ {
+ LockGuard<mutex> lock(serverLock());
+ getIOService()->poll();
+ }
} catch (const std::exception& e) {
// General catch-all exception that are not caught by more specific
// catches. This one is for exceptions derived from std::exception.
// receivePacket the process could wait up to the duration of timeout
// of select() to terminate.
try {
+ LockGuard<mutex> lock(serverLock());
handleSignal();
} catch (const std::exception& e) {
// Standard exception occurred. Let's be on the safe side to
// Regenerate server identifier if needed.
try {
- const std::string duid_file =
- std::string(CfgMgr::instance().getDataDir()) + "/" +
+ const std::string duid_file = CfgMgr::instance().getDataDir() + "/" +
std::string(SERVER_DUID_FILE);
DuidPtr duid = CfgMgr::instance().getStagingCfg()->getCfgDUID()->create(duid_file);
server_->serverid_.reset(new Option(Option::V6, D6O_SERVERID, duid->getDuid()));
// is no need to rollback configuration if socket fails to open on any
// of the interfaces.
CfgMgr::instance().getStagingCfg()->getCfgIface()->
- openSockets(AF_INET6, srv->getServerPort());
+ openSockets(AF_INET6, srv->getServerPort(), srv->serverLock());
// Install the timers for handling leases reclamation.
try {
// LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what());
}
- IfaceMgr::instance().closeSockets();
+ IfaceMgr::instance().closeSockets(serverLock());
LeaseMgrFactory::destroy();
}
Pkt6Ptr Dhcpv6Srv::receivePacket(int timeout) {
- return (IfaceMgr::instance().receive6(timeout));
+ return (IfaceMgr::instance().receive6(timeout, 0, serverLock()));
}
void Dhcpv6Srv::sendPacket(const Pkt6Ptr& packet) {
while (!shutdown_) {
try {
run_one();
- getIOService()->poll();
+ {
+ LockGuard<mutex> lock(serverLock());
+ getIOService()->poll();
+ }
} catch (const std::exception& e) {
// General catch-all standard exceptions that are not caught by more
// specific catches.
// process could wait up to the duration of timeout of select() to
// terminate.
try {
+ LockGuard<mutex> lock(serverLock());
handleSignal();
} catch (const std::exception& e) {
// An (a standard or ISC) exception occurred.