]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
updated multi-thread packet processing
authorRazvan Becheriu <razvan@isc.org>
Wed, 4 Sep 2019 15:09:27 +0000 (18:09 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 6 Nov 2019 17:32:51 +0000 (19:32 +0200)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.h
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/lib/util/threads/lock_guard.h [new file with mode: 0644]

index 19e172b4d2c4df398b5da93c892139a52d251cb1..59151338c78f977a5bea78c27494dd83c5a9e793 100644 (file)
@@ -944,7 +944,6 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
         CommandMgr::instance().deregisterCommand("config-get");
         CommandMgr::instance().deregisterCommand("config-set");
         CommandMgr::instance().deregisterCommand("config-reload");
-        CommandMgr::instance().deregisterCommand("config-set");
         CommandMgr::instance().deregisterCommand("config-test");
         CommandMgr::instance().deregisterCommand("config-write");
         CommandMgr::instance().deregisterCommand("dhcp-disable");
index 3bd088c5126e31cc2466df04078b3edf54036b4a..f8ee92c9bf956f85da6309acf0483d8d19f3a99a 100644 (file)
@@ -1013,6 +1013,7 @@ protected:
     /// UDP port number on which server listens.
     uint16_t server_port_;
 
+protected:
     /// UDP port number to which server sends all responses.
     uint16_t client_port_;
 
index ea508213d36e0b250b4ae3af512450ed6278ad27..e48efdb24b6044bbcb6bb24fcbcc17a979168eba 100644 (file)
 #include <sstream>
 #include <thread>
 
+#include <sys/select.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
 using namespace std;
 using namespace isc;
 using namespace isc::asiolink;
diff --git a/src/lib/util/threads/lock_guard.h b/src/lib/util/threads/lock_guard.h
new file mode 100644 (file)
index 0000000..6c949a2
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef LOCK_GUARD_H
+#define LOCK_GUARD_H
+
+#include <memory>
+
+namespace isc {
+namespace util {
+namespace thread {
+
+template <typename Lock>
+class LockGuard {
+public:
+    LockGuard(Lock* lock) : lk_(lock) {
+        if (lk_) {
+            lk_->lock();
+        }
+    }
+
+    ~LockGuard() {
+        if (lk_) {
+            lk_->unlock();
+        }
+    }
+
+    LockGuard(const LockGuard&) = delete;
+    LockGuard& operator=(const LockGuard&) = delete;
+
+    LockGuard(LockGuard&&) = delete;
+    LockGuard& operator=(LockGuard&&) = delete;
+
+private:
+    Lock* lk_;
+};
+
+}  // namespace thread
+}  // namespace util
+}  // namespace isc
+
+#endif  // LOCK_GUARD_H