]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1282] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Mon, 29 Jun 2020 15:14:20 +0000 (17:14 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 29 Jun 2020 15:14:20 +0000 (17:14 +0200)
src/bin/dhcp4/dhcp4to6_ipc.cc
src/hooks/dhcp/high_availability/libloadtests/close_unittests.cc
src/lib/hooks/hooks_manager.cc

index 9795b9f9fe7db3a6fcd2c2833d67f249b7e8b060..074fde6618b479ca1fb5fe61af7d01dab60ca5a0 100644 (file)
@@ -187,6 +187,5 @@ void Dhcp4to6Ipc::handler(int /* fd */) {
     }
 }
 
-};  // namespace dhcp
-
-};  // namespace isc
+} // namespace dhcp
+} // namespace isc
index 0c3d1651cd1e509933b8100e1dfc3dd6f4d60a12..ae9a55534cca9d700ab48e9f23b2b40e82efe061 100644 (file)
@@ -219,8 +219,8 @@ CloseHATest::runPartners() {
                 nfd = accept_partner1;
             }
             // FD_SET(accept_partner2, &fds);
-            if (accept_partner1 > nfd) {
-                nfd = accept_partner1;
+            if (accept_partner2 > nfd) {
+                nfd = accept_partner2;
             }
             for (auto reader : readers) {
                 if (!reader.second) {
@@ -258,7 +258,7 @@ CloseHATest::runPartners() {
                 if (fd < 0) {
                     cerr << "accept2 failed " << strerror(errno) << endl;
                 } else {
-                    if (fcntl(fd, F_SETFL, O_NONBLOCK)) {
+                    if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
                         cerr << "fcntl NONBLOCK " << strerror(errno) << endl;
                     }
                     readers[fd] = true;
@@ -268,7 +268,7 @@ CloseHATest::runPartners() {
                 if (!reader.second) {
                     continue;
                 }
-                int     fd = reader.first;
+                int fd = reader.first;
                 if (FD_ISSET(fd, &fds)) {
                     char buf[128];
                     int cc = read(fd, buf, 128);
index c19bfcac605cf0e5d928ddf815594fdca35477ba..0f13eeda802c3d0204b91562e4f7350b233c56c4 100644 (file)
@@ -150,16 +150,11 @@ HooksManager::unloadLibrariesInternal() {
 
     // If there was another owner the previous library manager collection
     // was not destroyed and libraries not closed.
-    if (!weak_lmc.expired()) {
+    boost::shared_ptr<LibraryManagerCollection> still_here = weak_lmc.lock();
+    if (still_here) {
         // Restore the library manager collection.
-        boost::shared_ptr<LibraryManagerCollection> restored_lmc = weak_lmc.lock();
-        if (restored_lmc) {
-            lm_collection_ = restored_lmc;
-            return (false);
-        }
-        // The library manager collection was destroyed between calls to
-        // expired and lock.
-        // assert(weak_lmc.expired());
+        lm_collection_ = still_here;
+        return (false);
     }
 
     // Load the empty set of libraries.