]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#572] addressed review comments
authorWlodek Wencel <wlodek@isc.org>
Wed, 20 Nov 2019 05:15:24 +0000 (12:15 +0700)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 20 Nov 2019 06:52:57 +0000 (14:52 +0800)
src/bin/perfdhcp/stats_mgr.h
src/bin/perfdhcp/test_control.cc
src/bin/perfdhcp/tests/test_control_unittest.cc

index efbd75c040fadee92c67ea27eaf2fee31dbfae8a..4a7e4294a35d7ad4c1521daea8e0c0ff0b57dfa8 100644 (file)
@@ -465,7 +465,12 @@ public:
     ///
     /// \return number of rejected leases.
     uint64_t getRejLeasesNum() const { return(rejected_leases_num_); }
+
+    /// \brief Increase number of rejected leases.
+    ///
+    /// Method increase total number of rejected leases by one.
     void updateRejLeases() { ++rejected_leases_num_; }
+
     /// \brief Print main statistics for packet exchange.
     ///
     /// Method prints main statistics for particular exchange.
@@ -628,7 +633,8 @@ private:
     uint64_t sent_packets_num_;    ///< Total number of sent packets.
     uint64_t rcvd_packets_num_;    ///< Total number of received packets.
 
-    uint64_t rejected_leases_num_;  ///< Total number of rejected leases (e.g. NoAddrAvail)
+    uint64_t rejected_leases_num_; ///< Total number of rejected leases
+                                   /// (e.g. NoAddrAvail)
     boost::posix_time::ptime boot_time_; ///< Time when test is started.
 };
 
@@ -984,9 +990,15 @@ public:
         ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
         return(xchg_stats->getRejLeasesNum());
     }
+
+    /// \brief Increase total number of rejected leases
+    ///
+    /// Method increase total number of rejected leases by one
+    /// for specified exchange type
     void updateRejLeases(const ExchangeType xchg_type) {
     ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
-           xchg_stats->updateRejLeases(); }
+        xchg_stats->updateRejLeases(); }
+
     /// \brief Get time period since the start of test.
     ///
     /// Calculate dna return period since the test start. This
index 7e0e9330e1a7c1249ade84c765ab1431631feef8..2dc7933afd1f85ea75495dc4a91b9911a3e776fd 100644 (file)
@@ -807,11 +807,11 @@ TestControl::validateIA(const Pkt6Ptr& pkt6) {
     // OptionCollection ias = pkt6->getOptions(D6O_IA_NA);
     Option6IAPrefixPtr iapref;
     Option6IAAddrPtr iaaddr;
-    if (pkt6->getOption(D6O_IA_PD)){
+    if (pkt6->getOption(D6O_IA_PD)) {
         iapref = boost::dynamic_pointer_cast<
                  Option6IAPrefix>(pkt6->getOption(D6O_IA_PD)->getOption(D6O_IAPREFIX));
     }
-    if (pkt6->getOption(D6O_IA_NA)){
+    if (pkt6->getOption(D6O_IA_NA)) {
         iaaddr = boost::dynamic_pointer_cast<
                  Option6IAAddr>(pkt6->getOption(D6O_IA_NA)->getOption(D6O_IAADDR));
     }
@@ -826,8 +826,7 @@ TestControl::validateIA(const Pkt6Ptr& pkt6) {
           && !options_.getLeaseType()
              .includes(CommandOptions::LeaseType::ADDRESS_AND_PREFIX))) {
        return true;
-    }
-    else {
+    } else {
         return false;
     }
 }
@@ -848,8 +847,7 @@ TestControl::processReceivedPacket6(const Pkt6Ptr& pkt6) {
                     /// used to access template_buffers_.
                     sendRequest6(template_buffers_[1], pkt6);
                }
-            }
-            else {
+            } else {
                 stats_mgr_.updateRejLeases(ExchangeType::SA);
             }
         }
@@ -873,8 +871,7 @@ TestControl::processReceivedPacket6(const Pkt6Ptr& pkt6) {
                     // message to a storage.
                     reply_storage_.append(pkt6);
                 }
-            }
-            else {
+            } else {
                 stats_mgr_.updateRejLeases(ExchangeType::RR);
             }
         // The Reply message is not a server's response to the Request message
index 4a31f98b783949383934d2a4270736c51202cd60..5281f605cd2579c9e22dc9d4e8f3c27dff6de9c6 100644 (file)
@@ -952,7 +952,7 @@ public:
         // Simulate Advertise responses from the server. Each advertise is
         // assigned a transaction id from the range of 1 to 6 with incorrect IA
         // included in the message
-        for (unsigned i = generator->getNext() - 10; i < 7; ++i) {
+        for (uint32_t i = generator->getNext() - 10; i < 7; ++i) {
             Pkt6Ptr advertise(createAdvertisePkt6(tc, i, false));
             tc.processReceivedPacket6(advertise);
         }
@@ -961,7 +961,7 @@ public:
         // Simulate Advertise responses from the server. Each advertise is
         // assigned a transaction id from the range of 7 to 10 with correct IA
         // included in the message
-        for (unsigned i = generator->getNext() - 7; i < 11; ++i) {
+        for (uint32_t i = generator->getNext() - 7; i < 11; ++i) {
             Pkt6Ptr advertise(createAdvertisePkt6(tc, i));
             tc.processReceivedPacket6(advertise);
         }