From: JINMEI Tatuya Date: Fri, 30 Dec 2011 22:42:15 +0000 (-0800) Subject: [805] some trivial cleanups: typo, constify, string=>char* conversion X-Git-Tag: trac2351_base~304^2~16^2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb00c59b03275b564938cbbb32956639bf76e5e8;p=thirdparty%2Fkea.git [805] some trivial cleanups: typo, constify, string=>char* conversion (based on the seeming intent), indentation. --- diff --git a/src/lib/asiodns/tcp_server.h b/src/lib/asiodns/tcp_server.h index 71cd5ba981..c7fac8703a 100644 --- a/src/lib/asiodns/tcp_server.h +++ b/src/lib/asiodns/tcp_server.h @@ -42,9 +42,10 @@ public: const isc::asiolink::SimpleCallback* checkin = NULL, const DNSLookup* lookup = NULL, const DNSAnswer* answer = NULL); + /// \brief Constructor /// \param io_service the asio::io_service to work with - /// \param fd the file descriptor of opened UDP socket + /// \param fd the file descriptor of opened TCP socket /// \param v6 the socket in fd is ipv6 one (if false, it is ipv4) /// \param checkin the callbackprovider for non-DNS events /// \param lookup the callbackprovider for DNS lookup events diff --git a/src/lib/asiodns/tests/dns_server_unittest.cc b/src/lib/asiodns/tests/dns_server_unittest.cc index 92b5f02e0d..e67f4a21e5 100644 --- a/src/lib/asiodns/tests/dns_server_unittest.cc +++ b/src/lib/asiodns/tests/dns_server_unittest.cc @@ -74,12 +74,12 @@ using namespace isc::asiodns; using namespace asio; namespace { -const char* server_ip = "::1"; +const char* const server_ip = "::1"; const int server_port = 5553; -const char* server_port_str = "5553"; +const char* const server_port_str = "5553"; //message client send to udp server, which isn't dns package //just for simple testing -const std::string query_message("BIND10 is awesome"); +const char* const query_message = "BIND10 is awesome"; // \brief provide capacity to derived class the ability // to stop DNSServer at certern point @@ -205,7 +205,7 @@ class SimpleClient : public ServerStopper { class UDPClient : public SimpleClient { public: - //After 1 seconds without feedback client will stop wait + //After 1 second without feedback client will stop wait static const unsigned int server_time_out = 1; UDPClient(asio::io_service& service, const ip::udp::endpoint& server) : @@ -310,12 +310,14 @@ class TCPClient : public SimpleClient { uint16_t data_to_send_len_; }; -// \brief provide the context which including two client and -// two server, udp client will only communicate with udp server, same for tcp client +// \brief provide the context which including two clients and +// two servers, UDP client will only communicate with UDP server, same for TCP +// client // -// This is only the active part of the test. We run the test case twice, once for each -// type of initialization (once when giving it the address and port, once when giving -// the file descriptor), to ensure it works both ways exactly the same. +// This is only the active part of the test. We run the test case twice, once +// for each type of initialization (once when giving it the address and port, +// once when giving the file descriptor), to ensure it works both ways exactly +// the same. class DNSServerTestBase : public::testing::Test { protected: void TearDown() { @@ -338,9 +340,9 @@ class DNSServerTestBase : public::testing::Test { stopper->setServerToStop(server); (*server)(); client->sendDataThenWaitForFeedback(query_message); - // Since thread hasn't been introduced into the tool box, using signal - // to make sure run function will eventually return even server stop - // failed + // Since thread hasn't been introduced into the tool box, using + // signal to make sure run function will eventually return even + // server stop failed void (*prev_handler)(int) = std::signal(SIGALRM, DNSServerTestBase::stopIOService); alarm(io_service_time_out); diff --git a/src/lib/asiodns/udp_server.cc b/src/lib/asiodns/udp_server.cc index a47e699e6a..176853d542 100644 --- a/src/lib/asiodns/udp_server.cc +++ b/src/lib/asiodns/udp_server.cc @@ -174,13 +174,14 @@ struct UDPServer::Data { /// The constructor. It just creates new internal state object /// and lets it handle the initialization. UDPServer::UDPServer(io_service& io_service, const ip::address& addr, - const uint16_t port, SimpleCallback* checkin, DNSLookup* lookup, - DNSAnswer* answer) : + const uint16_t port, SimpleCallback* checkin, + DNSLookup* lookup, DNSAnswer* answer) : data_(new Data(io_service, addr, port, checkin, lookup, answer)) { } UDPServer::UDPServer(io_service& io_service, int fd, bool v6, - SimpleCallback* checkin, DNSLookup* lookup, DNSAnswer* answer) : + SimpleCallback* checkin, DNSLookup* lookup, + DNSAnswer* answer) : data_(new Data(io_service, fd, v6, checkin, lookup, answer)) { } diff --git a/src/lib/asiodns/udp_server.h b/src/lib/asiodns/udp_server.h index 2d564fc228..f5a9b856f8 100644 --- a/src/lib/asiodns/udp_server.h +++ b/src/lib/asiodns/udp_server.h @@ -51,6 +51,7 @@ public: isc::asiolink::SimpleCallback* checkin = NULL, DNSLookup* lookup = NULL, DNSAnswer* answer = NULL); + /// \brief Constructor /// \param io_service the asio::io_service to work with /// \param fd the file descriptor of opened UDP socket @@ -59,8 +60,8 @@ public: /// \param lookup the callbackprovider for DNS lookup events /// \param answer the callbackprovider for DNS answer events UDPServer(asio::io_service& io_service, int fd, bool v6, - isc::asiolink::SimpleCallback* checkin = NULL, - DNSLookup* lookup = NULL, DNSAnswer* answer = NULL); + isc::asiolink::SimpleCallback* checkin = NULL, + DNSLookup* lookup = NULL, DNSAnswer* answer = NULL); /// \brief The function operator void operator()(asio::error_code ec = asio::error_code(),