[svn] commit: r3548 - in /experiments/kambe-auth-stats/src/bin: auth/auth_srv.cc auth/tests/asio_link_unittest.cc bind10/bind10.py.in
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Nov 17 10:50:36 UTC 2010
Author: naokikambe
Date: Wed Nov 17 10:50:35 2010
New Revision: 3548
Log:
- use createCommand when creating command to send statistics
- fix wrong shutdown command by Boss
- fix failure in CentOS when testing unavailableAddress
Modified:
experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc
experiments/kambe-auth-stats/src/bin/auth/tests/asio_link_unittest.cc
experiments/kambe-auth-stats/src/bin/bind10/bind10.py.in
Modified: experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc
==============================================================================
--- experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc (original)
+++ experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc Wed Nov 17 10:50:35 2010
@@ -112,8 +112,7 @@
size_t timeout_sec_;
private:
// the query counters, just incremental
- unsigned long long int udp_q_count_;
- unsigned long long int tcp_q_count_;
+ uint64_t udp_q_count_, tcp_q_count_;
// default timeout seconds
static const size_t DEFAULT_TIMEOUT_SEC_ = 180;
static const size_t MIN_TIMEOUT_SEC_ = 3;
@@ -634,27 +633,29 @@
return (false);
}
+ static const string arg_head = "{ \"stats_data\": {";
+ static const string arg_udp = "\"auth.queries.udp\":";
+ static const string arg_tcp = "\"auth.queries.tcp\":";
+ static const string arg_foot = "} }";
+
// construct command string
- static const string command_head =
- "{ \"command\": [ \"set\", { \"stats_data\": {";
- static const string command_udp = "\"auth.queries.udp\"";
- static const string command_tcp = "\"auth.queries.tcp\"";
- static const string command_foot = "} } ] }";
- string udp_q_count_str_ = boost::lexical_cast<string>(udp_q_count_);
- string tcp_q_count_str_ = boost::lexical_cast<string>(tcp_q_count_);
- string command_str = command_head
- + command_udp + ":" + udp_q_count_str_ + ","
- + command_tcp + ":" + tcp_q_count_str_
- + command_foot;
+ ConstElementPtr stats_command =
+ isc::config::createCommand("set", Element::fromJSON(
+ arg_head
+ + arg_udp
+ + boost::lexical_cast<string>(udp_q_count_) + ","
+ + arg_tcp
+ + boost::lexical_cast<string>(tcp_q_count_)
+ + arg_foot
+ ));
// send to stats module
try {
- ConstElementPtr stats_command = Element::fromJSON(command_str);
const unsigned int seq =
stats_session_->group_sendmsg(stats_command,
"Stats", "*", "*");
if (verbose_mode_) {
- cerr << "[b10-auth] send statistics: " << command_str << endl;
+ cerr << "[b10-auth] send statistics: " << stats_command->str() << endl;
}
ConstElementPtr env, answer, parsed_answer;
stats_session_->group_recvmsg(env, answer, false, seq);
Modified: experiments/kambe-auth-stats/src/bin/auth/tests/asio_link_unittest.cc
==============================================================================
--- experiments/kambe-auth-stats/src/bin/auth/tests/asio_link_unittest.cc (original)
+++ experiments/kambe-auth-stats/src/bin/auth/tests/asio_link_unittest.cc Wed Nov 17 10:50:35 2010
@@ -108,7 +108,13 @@
TEST(IOServiceTest, unavailableAddress) {
// These addresses should generally be unavailable as a valid local
// address, although there's no guarantee in theory.
- EXPECT_THROW(IOService(NULL, *TEST_PORT, *"255.255.0.0"), IOError);
+ EXPECT_THROW({
+ const char* const mcaddr_ = "255.255.0.0";
+ IOService* io_service_ = new IOService(NULL, *TEST_PORT, *mcaddr_);
+ delete io_service_;
+ // if it threw nothing, explicitly throw again
+ isc_throw(IOError, "Invalid IP address '" << mcaddr_ << "'");
+ }, IOError);
// Some OSes would simply reject binding attempt for an AF_INET6 socket
// to an IPv4-mapped IPv6 address. Even if those that allow it, since
Modified: experiments/kambe-auth-stats/src/bin/bind10/bind10.py.in
==============================================================================
--- experiments/kambe-auth-stats/src/bin/bind10/bind10.py.in (original)
+++ experiments/kambe-auth-stats/src/bin/bind10/bind10.py.in Wed Nov 17 10:50:35 2010
@@ -465,7 +465,7 @@
self.cc_session.group_sendmsg(cmd, "Xfrout", "Xfrout")
self.cc_session.group_sendmsg(cmd, "Xfrin", "Xfrin")
self.cc_session.group_sendmsg(cmd, "Zonemgr", "Zonemgr")
- self.cc_session.group_sendmsg(cmd, "Boss", "Stats")
+ self.cc_session.group_sendmsg(cmd, "Stats", "Stats")
def stop_process(self, process):
"""Stop the given process, friendly-like."""
More information about the bind10-changes
mailing list