[svn] commit: r3904 - in /branches/trac347/src/bin/auth: asio_link.cc asio_link.h main.cc statistics.cc statistics.h tests/asio_link_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 20 23:15:27 UTC 2010
Author: jinmei
Date: Mon Dec 20 23:15:23 2010
New Revision: 3904
Log:
some suggested changes on style/documentation
Modified:
branches/trac347/src/bin/auth/asio_link.cc
branches/trac347/src/bin/auth/asio_link.h
branches/trac347/src/bin/auth/main.cc
branches/trac347/src/bin/auth/statistics.cc
branches/trac347/src/bin/auth/statistics.h
branches/trac347/src/bin/auth/tests/asio_link_unittest.cc
Modified: branches/trac347/src/bin/auth/asio_link.cc
==============================================================================
--- branches/trac347/src/bin/auth/asio_link.cc (original)
+++ branches/trac347/src/bin/auth/asio_link.cc Mon Dec 20 23:15:23 2010
@@ -698,7 +698,7 @@
void
IntervalTimerImpl::setupTimer(const IntervalTimer::Callback& cbfunc,
- const uint32_t interval)
+ const uint32_t interval)
{
// Interval should not be 0.
if (interval == 0) {
Modified: branches/trac347/src/bin/auth/asio_link.h
==============================================================================
--- branches/trac347/src/bin/auth/asio_link.h (original)
+++ branches/trac347/src/bin/auth/asio_link.h Mon Dec 20 23:15:23 2010
@@ -459,19 +459,19 @@
/// it expires.
///
/// The function calls the call back function set by \c setupTimer()
-/// and update the timer to expire on (now + interval).
+/// and updates the timer to expire in (now + interval) seconds.
/// The type of call back function is \c void(void).
///
/// This class is mainly designed to use for calling
/// \c QueryCounters::submitStatistics() periodically.
///
-/// Note: Destruction of the instance of this class while call back
-/// is pending causes throwing an exception from IOService.
+/// Note: Destruction of an instance of this class while call back
+/// is pending causes throwing an exception from \c IOService.
///
/// Sample code:
/// \code
/// void function_to_call_back() {
-/// // this function will called periodically
+/// // this function will be called periodically
/// }
/// int interval_in_seconds = 1;
/// IOService io_service;
@@ -505,11 +505,12 @@
/// \param io_service A reference to an instance of IOService
///
IntervalTimer(IOService& io_service);
+
/// \brief The destructor.
///
/// This destructor never throws an exception.
///
- /// On the destruction of this class the timer will be cancelled
+ /// On the destruction of this class the timer will be canceled
/// inside \c asio::deadline_timer.
///
~IntervalTimer();
Modified: branches/trac347/src/bin/auth/main.cc
==============================================================================
--- branches/trac347/src/bin/auth/main.cc (original)
+++ branches/trac347/src/bin/auth/main.cc Mon Dec 20 23:15:23 2010
@@ -25,7 +25,6 @@
#include <cassert>
#include <iostream>
-#include <boost/foreach.hpp>
#include <boost/bind.hpp>
#include <exceptions/exceptions.h>
@@ -102,13 +101,13 @@
cerr << "Usage: b10-auth [-a address] [-p port] [-4|-6] [-nv]" << endl;
exit(1);
}
-} // end of anonymous namespace
void
statisticsTimerCallback(AuthSrv* auth_server) {
assert(auth_server != NULL);
auth_server->submitStatistics();
}
+} // end of anonymous namespace
int
main(int argc, char* argv[]) {
@@ -249,8 +248,7 @@
itimer = new asio_link::IntervalTimer(*io_service);
// set up interval timer
// register function to send statistics with interval
- itimer->setupTimer(boost::bind(statisticsTimerCallback,
- auth_server),
+ itimer->setupTimer(boost::bind(statisticsTimerCallback, auth_server),
STATS_SEND_INTERVAL_SEC);
cout << "[b10-auth] Interval timer set to send stats." << endl;
Modified: branches/trac347/src/bin/auth/statistics.cc
==============================================================================
--- branches/trac347/src/bin/auth/statistics.cc (original)
+++ branches/trac347/src/bin/auth/statistics.cc Mon Dec 20 23:15:23 2010
@@ -59,8 +59,7 @@
{}
void
-QueryCountersImpl::inc(const QueryCounters::QueryCounterType type)
-{
+QueryCountersImpl::inc(const QueryCounters::QueryCounterType type) {
try {
++counters_.at(type);
} catch (std::out_of_range) {
Modified: branches/trac347/src/bin/auth/statistics.h
==============================================================================
--- branches/trac347/src/bin/auth/statistics.h (original)
+++ branches/trac347/src/bin/auth/statistics.h Mon Dec 20 23:15:23 2010
@@ -14,10 +14,8 @@
// $Id$
-#ifndef __STATS_H
-#define __STATS_H 1
-
-#include <boost/function.hpp>
+#ifndef __STATISTICS_H
+#define __STATISTICS_H 1
#include <cc/session.h>
@@ -135,7 +133,7 @@
const std::vector<uint64_t>& getCounters() const;
};
-#endif // __STATS_H
+#endif // __STATISTICS_H
// Local Variables:
// mode: c++
Modified: branches/trac347/src/bin/auth/tests/asio_link_unittest.cc
==============================================================================
--- branches/trac347/src/bin/auth/tests/asio_link_unittest.cc (original)
+++ branches/trac347/src/bin/auth/tests/asio_link_unittest.cc Mon Dec 20 23:15:23 2010
@@ -329,7 +329,7 @@
// to TimerCallBack.
test_obj_->timer_called_ = false;
timer_.setupTimer(IntervalTimer::Callback(
- TimerCallBack(test_obj_)), 1);
+ TimerCallBack(test_obj_)), 1);
} else if (count_ == 2) {
// Second time of call back.
// If it reaches here, re-setupTimer() is failed (unexpected).
@@ -491,7 +491,7 @@
TEST_F(ASIOLinkTest, destructIntervalTimer) {
// The call back function will not be called
- // after the timer destucted.
+ // after the timer is destructed.
setIOService(false, false);
// There are two timers:
// itimer_counter (A)
@@ -546,7 +546,7 @@
// itimer_overwriter (B)
// (Calls TimerCallBackOverwriter)
// - first time of callback, it calls setupTimer() to change
- // call back function and interval of itimer to
+ // call back function and interval of itimer to
// TimerCallBack / 1 second
// after 3 + 1 seconds from the beginning of this test,
// TimerCallBack() will be called and io_service_ stops.
More information about the bind10-changes
mailing list