BIND 10 master, updated. 43c5b414355bf16d31826aeb633ba68f68564848 [master] Fix a bug in perfdhcp in elapsed time calculation.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 23 08:20:11 UTC 2014


The branch, master has been updated
       via  43c5b414355bf16d31826aeb633ba68f68564848 (commit)
      from  f04b17998eb9024b4801ac96eda3113abcbde74a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 43c5b414355bf16d31826aeb633ba68f68564848
Author: Marcin Siodelski <marcin at isc.org>
Date:   Thu Jan 23 09:19:35 2014 +0100

    [master] Fix a bug in perfdhcp in elapsed time calculation.
    
    This fix was okayed on jabber. It solves the problem in elapsed time
    calculation between two DHCP packets. If the timestamp for both packets
    is equal, the elapsed time is now 0. Previously, an exception was thrown.

-----------------------------------------------------------------------

Summary of changes:
 tests/tools/perfdhcp/test_control.cc |    9 +++------
 tests/tools/perfdhcp/test_control.h  |    7 ++++++-
 2 files changed, 9 insertions(+), 7 deletions(-)

-----------------------------------------------------------------------
diff --git a/tests/tools/perfdhcp/test_control.cc b/tests/tools/perfdhcp/test_control.cc
index 3751e2f..ab56bc3 100644
--- a/tests/tools/perfdhcp/test_control.cc
+++ b/tests/tools/perfdhcp/test_control.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -564,11 +564,8 @@ TestControl::getElapsedTime(const T& pkt1, const T& pkt2) {
         isc_throw(InvalidOperation, "packet timestamp not set");;
     }
     time_period elapsed_period(pkt1_time, pkt2_time);
-    if (elapsed_period.is_null()) {
-        isc_throw(InvalidOperation, "unable to calculate time elapsed"
-                  " between packets");
-    }
-    return(elapsed_period.length().total_milliseconds());
+    return (elapsed_period.is_null() ? 0 :
+            elapsed_period.length().total_milliseconds());
 }
 
 int
diff --git a/tests/tools/perfdhcp/test_control.h b/tests/tools/perfdhcp/test_control.h
index 5a7ef48..a0746a0 100644
--- a/tests/tools/perfdhcp/test_control.h
+++ b/tests/tools/perfdhcp/test_control.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -943,6 +943,11 @@ protected:
 
     /// \brief Calculate elapsed time between two packets.
     ///
+    /// This function calculates the time elapsed between two packets. If
+    /// the timestamp of the pkt2 is greater than timestamp of the pkt1,
+    /// the positive value is returned. If the pkt2 timestamp is equal or
+    /// less than pkt1 timestamp, 0 is returned.
+    ///
     /// \tparam T Pkt4Ptr or Pkt6Ptr class.
     /// \param pkt1 first packet.
     /// \param pkt2 second packet.



More information about the bind10-changes mailing list