[svn] commit: r3631 - /experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 24 11:23:05 UTC 2010


Author: naokikambe
Date: Wed Nov 24 11:23:05 2010
New Revision: 3631

Log:
add long lines line break 
add const to declares of variable
change argument of getValue function

Modified:
    experiments/kambe-auth-stats/src/bin/auth/auth_srv.cc

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 24 11:23:05 2010
@@ -514,15 +514,15 @@
     if (config && config->contains("stats_timeout_sec")) {
         new_timeout_sec_ = config->get("stats_timeout_sec")->intValue();
     } else if (config_session_ != NULL) {
-        bool is_default;
-        string item("stats_timeout_sec");
-        new_timeout_sec_ = config_session_->getValue(is_default, item)->intValue();
+        new_timeout_sec_ =
+            config_session_->getValue("stats_timeout_sec")->intValue();
     }
     if (new_timeout_sec_ != timeout_sec_) {
-        if (new_timeout_sec_ < MIN_TIMEOUT_SEC_ || MAX_TIMEOUT_SEC_ < new_timeout_sec_) {
+        if (new_timeout_sec_ < MIN_TIMEOUT_SEC_
+            || MAX_TIMEOUT_SEC_ < new_timeout_sec_) {
             if (verbose_mode_) {
-                cerr << "[b10-auth] Timeout is beyond the min or max value, no changes: "
-                     << new_timeout_sec_ << endl;
+                cerr << "[b10-auth] Timeout is beyond the min or max value,"
+                     << " no changes: " << new_timeout_sec_ << endl;
             }
         } else {
             if (verbose_mode_) {
@@ -600,12 +600,12 @@
 AuthSrvImpl::addQryCounts(const IOMessage& io_message)
 {
     // get protocol
-    int protocol = io_message.getSocket().getProtocol();
+    const int protocol = io_message.getSocket().getProtocol();
 
     if (protocol == IPPROTO_TCP) {
         // in case of TCP
         tcp_q_count_++;
-    } else if (protocol == IPPROTO_UDP){
+    } else if (protocol == IPPROTO_UDP) {
         // in case of UDP
         udp_q_count_++;
     } else {
@@ -638,16 +638,18 @@
     static const string arg_tcp = "\"auth.queries.tcp\":";
     static const string arg_foot = "} }";
 
-    // construct command string
-    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
-                                       ));
+    // construct argument string
+    const 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 {
@@ -655,12 +657,13 @@
             stats_session_->group_sendmsg(stats_command,
                                           "Stats", "*", "*");
         if (verbose_mode_) {
-            cerr << "[b10-auth] send statistics: " << stats_command->str() << endl;
-        }
-        ConstElementPtr env, answer, parsed_answer;
+            cerr << "[b10-auth] send statistics: " << stats_command->str()
+                 << endl;
+        }
+        ConstElementPtr env, answer;
         stats_session_->group_recvmsg(env, answer, false, seq);
         int rcode;
-        parsed_answer = parseAnswer(rcode, answer);
+        const ConstElementPtr parsed_answer = parseAnswer(rcode, answer);
         if (rcode != 0) {
             if (verbose_mode_) {
                 cerr << "[b10-auth] failed to send statistics: "
@@ -670,8 +673,8 @@
         }
     } catch (const SessionTimeout& st) {
         if (verbose_mode_) {
-            cerr << "[b10-auth] failed to send statistics: caught SessionTimeout: "
-                 << st.what() << endl;
+            cerr << "[b10-auth] failed to send statistics: "
+                 << "caught SessionTimeout: " << st.what() << endl;
         }
         return (false);
     } catch (const Exception& ex) {




More information about the bind10-changes mailing list