From: Razvan Becheriu Date: Mon, 25 Mar 2019 16:40:55 +0000 (+0200) Subject: do not use mutex X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e23ee697f0631576d1fd6d1d2d066dc34bdd687;p=thirdparty%2Fkea.git do not use mutex --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 78ea7bec39..eb94f087a6 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -663,7 +663,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { // 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(), srv->serverLock(), + openSockets(AF_INET, srv->getServerPort(), getInstance()->useBroadcast()); // Install the timers for handling leases reclamation. diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 0ff829634e..73a8c4c536 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -750,10 +750,7 @@ Dhcpv4Srv::run() { while (!shutdown_) { try { run_one(); - { - LockGuard lock(serverLock()); - getIOService()->poll(); - } + 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. @@ -846,7 +843,6 @@ Dhcpv4Srv::run_one() { // receivePacket the process could wait up to the duration of timeout // of select() to terminate. try { - LockGuard lock(serverLock()); handleSignal(); } catch (const std::exception& e) { // Standard exception occurred. Let's be on the safe side to diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index b4dbe22bc1..d3010da53c 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -626,7 +626,8 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { // Regenerate server identifier if needed. try { - const std::string duid_file = CfgMgr::instance().getDataDir() + "/" + + const std::string duid_file = + std::string(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())); @@ -684,7 +685,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) { // 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(), srv->serverLock()); + openSockets(AF_INET6, srv->getServerPort()); // Install the timers for handling leases reclamation. try { diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 407a45150e..d3b4025e29 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -242,7 +242,7 @@ Dhcpv6Srv::~Dhcpv6Srv() { // LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what()); } - IfaceMgr::instance().closeSockets(serverLock()); + IfaceMgr::instance().closeSockets(); LeaseMgrFactory::destroy(); @@ -256,7 +256,7 @@ void Dhcpv6Srv::shutdown() { } Pkt6Ptr Dhcpv6Srv::receivePacket(int timeout) { - return (IfaceMgr::instance().receive6(timeout, 0, serverLock())); + return (IfaceMgr::instance().receive6(timeout)); } void Dhcpv6Srv::sendPacket(const Pkt6Ptr& packet) { @@ -421,10 +421,7 @@ bool Dhcpv6Srv::run() { while (!shutdown_) { try { run_one(); - { - LockGuard lock(serverLock()); - getIOService()->poll(); - } + getIOService()->poll(); } catch (const std::exception& e) { // General catch-all standard exceptions that are not caught by more // specific catches. @@ -521,7 +518,6 @@ void Dhcpv6Srv::run_one() { // process could wait up to the duration of timeout of select() to // terminate. try { - LockGuard lock(serverLock()); handleSignal(); } catch (const std::exception& e) { // An (a standard or ISC) exception occurred.