BIND 10 trac1958, updated. b594cc0f845bf8c2fa7238aa8d153f642a3337ff [1958] Check for null pointers.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jul 23 14:58:52 UTC 2012
The branch, trac1958 has been updated
via b594cc0f845bf8c2fa7238aa8d153f642a3337ff (commit)
from 98c3fe102ae4b4e8769d2bf9412a5e5ab9225926 (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 b594cc0f845bf8c2fa7238aa8d153f642a3337ff
Author: Marcin Siodelski <marcin at isc.org>
Date: Mon Jul 23 16:58:43 2012 +0200
[1958] Check for null pointers.
-----------------------------------------------------------------------
Summary of changes:
tests/tools/perfdhcp/stats_mgr.h | 40 ++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/tests/tools/perfdhcp/stats_mgr.h b/tests/tools/perfdhcp/stats_mgr.h
index 7732bce..bfebfb2 100644
--- a/tests/tools/perfdhcp/stats_mgr.h
+++ b/tests/tools/perfdhcp/stats_mgr.h
@@ -131,7 +131,20 @@ public:
class ExchangeStats {
public:
+ /// \brief Hash transaction id of the packet.
+ ///
+ /// Function hashes transaction id of the packet. Hashing is
+ /// non-unique. Many packets may have the same hash value and thus
+ /// they belong to the same packet buckets. Packet buckets are
+ /// used for unordered packets search with multi index container.
+ ///
+ /// \param packet packet which transaction id is to be hashed.
+ /// \throw isc::BadValue if packet is null.
+ /// \return transaction id hash.
static uint32_t hashTransid(const boost::shared_ptr<T> packet) {
+ if (!packet) {
+ isc_throw(BadValue, "Packet is null");
+ }
return packet->getTransid() & 1023;
}
@@ -185,7 +198,11 @@ public:
/// Method adds new packet to list of sent packets.
///
/// \param packet packet object to be added.
+ /// \throw isc::BadValue if packet is null.
void appendSent(const boost::shared_ptr<T> packet) {
+ if (!packet) {
+ isc_throw(BadValue, "Packet is null");
+ }
++sent_packets_num_;
sent_packets_.template get<0>().push_back(packet);
}
@@ -195,7 +212,11 @@ public:
/// Method adds new packet to list of received packets.
///
/// \param packet packet object to be added.
+ /// \throw isc::BadValue if packet is null.
void appendRcvd(const boost::shared_ptr<T> packet) {
+ if (!packet) {
+ isc_throw(BadValue, "Packet is null");
+ }
++rcvd_packets_num_;
rcvd_packets_.template get<0>().push_back(packet);
}
@@ -207,9 +228,17 @@ public:
///
/// \param sent_packet sent packet
/// \param rcvd_packet received packet
+ /// \throw isc::BadValue if sent or received packet is null.
/// \throw isc::Unexpected if failed to calculate timestamps
void updateDelays(const boost::shared_ptr<const T> sent_packet,
const boost::shared_ptr<const T> rcvd_packet) {
+ if (!sent_packet) {
+ isc_throw(BadValue, "Sent packet is null");
+ }
+ if (!rcvd_packet) {
+ isc_throw(BadValue, "Received packet is null");
+ }
+
boost::posix_time::ptime sent_time = sent_packet->getTimestamp();
boost::posix_time::ptime rcvd_time = rcvd_packet->getTimestamp();
@@ -257,9 +286,14 @@ public:
/// packet search time significantly.
///
/// \param transid transaction id of the packet to search
+ /// \throw isc::BadValue if received packet is null.
/// \return packet having specified transaction or NULL if packet
/// not found
boost::shared_ptr<T> findSent(const boost::shared_ptr<T> rcvd_packet) {
+ if (!rcvd_packet) {
+ isc_throw(BadValue, "Received packet is null");
+ }
+
if (sent_packets_.size() == 0) {
// List of sent packets is empty so there is no sense
// to continue looking fo the packet. It also means
@@ -569,7 +603,8 @@ public:
///
/// \param xchg_type exchange type.
/// \param packet packet to be added to the list
- /// \throw isc::BadValue if invalid exchange type specified.
+ /// \throw isc::BadValue if invalid exchange type specified or
+ /// packet is null.
void passSentPacket(const ExchangeType xchg_type,
const boost::shared_ptr<T> packet) {
ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
@@ -585,7 +620,8 @@ public:
///
/// \param xchg_type exchange type.
/// \param packet received packet
- /// \throw isc::BadValue if invalid exchange type specified.
+ /// \throw isc::BadValue if invalid exchange type specified
+ /// or packet is null.
/// \throw isc::Unexpected if corresponding packet was not
/// found on the list of sent packets.
void passRcvdPacket(const ExchangeType xchg_type,
More information about the bind10-changes
mailing list