[svn] commit: r2336 - /branches/trac167/src/bin/auth/main.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 29 23:03:50 UTC 2010


Author: each
Date: Tue Jun 29 23:03:49 2010
New Revision: 2336

Log:
addressed review comments

Modified:
    branches/trac167/src/bin/auth/main.cc

Modified: branches/trac167/src/bin/auth/main.cc
==============================================================================
--- branches/trac167/src/bin/auth/main.cc (original)
+++ branches/trac167/src/bin/auth/main.cc Tue Jun 29 23:03:49 2010
@@ -27,8 +27,10 @@
 #include <cassert>
 #include <iostream>
 
+#include <boost/bind.hpp>
 #include <boost/foreach.hpp>
-#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+
 #include <asio.hpp>
 
 #include <exceptions/exceptions.h>
@@ -401,23 +403,21 @@
            AuthSrv* srv UNUSED_PARAM)
 {
     ServerSet servers;
-    short portnum = atoi(port);
-    asio::ip::address addr;
+    short portnum = boost::lexical_cast<short>(port);
 
     if (address != NULL) {
-        addr = asio::ip::address::from_string(address);
+        asio::ip::address addr = asio::ip::address::from_string(address);
+
         if ((addr.is_v6() && !use_ipv6)) {
-            cout << "[b10-auth] Error: -4 conflicts with " <<  addr << endl;
-            exit(1);
+            isc_throw(FatalError,
+                      "[b10-auth] Error: -4 conflicts with " << addr);
         }
 
         if ((addr.is_v4() && !use_ipv4)) {
-            cout << "[b10-auth] Error: -6 conflicts with " <<  addr << endl;
-            exit(1);
-        }
-    }
-
-    if (address) {
+            isc_throw(FatalError,
+                      "[b10-auth] Error: -6 conflicts with " << addr);
+        }
+
         servers.udp4_server = new UDPServer(io_service_, addr, portnum);
         servers.tcp4_server = new TCPServer(io_service_, addr, portnum);
     } else {
@@ -431,7 +431,7 @@
         }
     }
 
-    cout << "Server started." << endl;
+    cout << "[b10-auth] Server started." << endl;
     io_service_.run();
 }
 
@@ -460,7 +460,6 @@
             break;
         case '6':
             // The same note as -4 applies.
-cout << "here" << endl;
             use_ipv4 = false;
             break;
         case 'a':




More information about the bind10-changes mailing list