]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
do not use mutex
authorRazvan Becheriu <razvan@isc.org>
Mon, 25 Mar 2019 16:40:55 +0000 (18:40 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 12 Apr 2019 12:19:35 +0000 (15:19 +0300)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/dhcp6_srv.cc

index 78ea7bec3906f4229458caa8f19792e8d320efe8..eb94f087a6b4bcb11e7f75e590eb573cfb48e77b 100644 (file)
@@ -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.
index 0ff829634eae426d0815538862a0d238c7f0c443..73a8c4c536e656010879e7e69da16cd37f9d541e 100644 (file)
@@ -750,10 +750,7 @@ Dhcpv4Srv::run() {
     while (!shutdown_) {
         try {
             run_one();
-            {
-                LockGuard<mutex> 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<mutex> lock(serverLock());
         handleSignal();
     } catch (const std::exception& e) {
         // Standard exception occurred. Let's be on the safe side to
index b4dbe22bc16c52cbd071bad19bb7bd602214c451..d3010da53c2a1db0bfddf2de742ef63377a9eb59 100644 (file)
@@ -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 {
index 407a45150e3b019519683ba349bcd81289c66f3c..d3b4025e29a7a8e70b7f427a9182ac2d79ebcd98 100644 (file)
@@ -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<mutex> 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<mutex> lock(serverLock());
         handleSignal();
     } catch (const std::exception& e) {
         // An (a standard or ISC) exception occurred.