diff --git a/src/bin/d2/ncr_io.cc b/src/bin/d2/ncr_io.cc index 384cdb4936..46428a76b7 100644 --- a/src/bin/d2/ncr_io.cc +++ b/src/bin/d2/ncr_io.cc @@ -69,12 +69,8 @@ NameChangeListener::stopListening() { } void -#if 0 -NameChangeListener::invokeRecvHandler(Result result, NameChangeRequestPtr ncr) { -#else -NameChangeListener::invokeRecvHandler(const Result result, +NameChangeListener::invokeRecvHandler(const Result result, NameChangeRequestPtr& ncr) { -#endif // Call the registered application layer handler. recv_handler_(result, ncr); @@ -92,12 +88,8 @@ NameChangeListener::invokeRecvHandler(const Result result, // close the window by invoking the application handler with // a failed result, and let the application layer sort it out. LOG_ERROR(dctl_logger, DHCP_DDNS_NCR_RECV_NEXT).arg(ex.what()); -#if 0 - recv_handler_(ERROR, NameChangeRequestPtr()); -#else NameChangeRequestPtr empty; recv_handler_(ERROR, empty); -#endif } } } diff --git a/src/bin/d2/ncr_io.h b/src/bin/d2/ncr_io.h index 2669535bfa..cf2be107b3 100644 --- a/src/bin/d2/ncr_io.h +++ b/src/bin/d2/ncr_io.h @@ -39,7 +39,7 @@ /// data being transmitted. In other words, it doesn't know beans about /// NCRs. /// -/// The abstract classes defined here implement the latter, middle layer, +/// The abstract classes defined here implement the latter, middle layer, /// the NameChangeRequest layer. There are two types of participants in this /// middle ground: /// @@ -169,7 +169,7 @@ public: /// result is NameChangeListener::SUCCESS. It is indeterminate other /// wise. /// @throw This method MUST NOT throw. - virtual void operator ()(const Result result, + virtual void operator ()(const Result result, NameChangeRequestPtr& ncr) = 0; }; @@ -212,15 +212,15 @@ public: /// at application level and should trap and handle any errors at /// that level, rather than throw exceptions. If an error has occurred /// prior to invoking the handler, it will be expressed in terms a failed - /// result being passed to the handler, not a throw. Therefore any - /// exceptions at the handler level are application issues and should be + /// result being passed to the handler, not a throw. Therefore any + /// exceptions at the handler level are application issues and should be /// dealt with at that level. /// - /// If the handler were to throw, the exception will surface at - /// IOService::run (or run variant) method invocation as this occurs as - /// part of the callback chain. This will cause the invocation of - /// doReceive to be skipped which will break the listen-receive-listen - /// cycle. To restart the cycle it would be necessary to call + /// If the handler were to throw, the exception will surface at + /// IOService::run (or run variant) method invocation as this occurs as + /// part of the callback chain. This will cause the invocation of + /// doReceive to be skipped which will break the listen-receive-listen + /// cycle. To restart the cycle it would be necessary to call /// stopListener() and then startListener(). /// /// @param result contains that receive outcome status. @@ -508,10 +508,10 @@ public: /// handler level are application issues and should be dealt with at that /// level. /// - /// If the handler were to throw, the exception will surface at - /// IOService::run (or run variant) method invocation as this occurs as - /// part of the callback chain. This will cause the invocation of - /// sendNext to be skipped which will interrupt automatic buffer drain + /// If the handler were to throw, the exception will surface at + /// IOService::run (or run variant) method invocation as this occurs as + /// part of the callback chain. This will cause the invocation of + /// sendNext to be skipped which will interrupt automatic buffer drain /// cycle. Assuming there is not a connectivity issue, the cycle will /// resume with the next sendRequest call, or an explicit call to sendNext. /// @@ -535,7 +535,7 @@ public: /// /// This method can be used to discard all of the NCRs currently in the /// the send queue. Note it may not be called while the sender is in - /// the sending state. + /// the sending state. /// @throw throws NcrSenderError if called and sender is in sending state. void clearSendQueue(); diff --git a/src/bin/d2/ncr_udp.cc b/src/bin/d2/ncr_udp.cc index 1ee0a7a955..c208400752 100644 --- a/src/bin/d2/ncr_udp.cc +++ b/src/bin/d2/ncr_udp.cc @@ -70,8 +70,8 @@ UDPCallback::putData(const uint8_t* src, size_t len) { //*************************** NameChangeUDPListener *********************** NameChangeUDPListener:: -NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, - const uint32_t port, NameChangeFormat format, +NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, + const uint32_t port, NameChangeFormat format, RequestReceiveHandler& ncr_recv_handler, const bool reuse_address) : NameChangeListener(ncr_recv_handler), ip_address_(ip_address), @@ -79,10 +79,10 @@ NameChangeUDPListener(const isc::asiolink::IOAddress& ip_address, // Instantiate the receive callback. This gets passed into each receive. // Note that the callback constructor is passed an instance method // pointer to our recv_completion_handler. - recv_callback_.reset(new + recv_callback_.reset(new UDPCallback(RawBufferPtr(new uint8_t[RECV_BUF_MAX]), RECV_BUF_MAX, - UDPEndpointPtr(new + UDPEndpointPtr(new asiolink::UDPEndpoint()), boost::bind(&NameChangeUDPListener:: recv_completion_handler, this, _1, _2))); diff --git a/src/bin/d2/tests/ncr_udp_unittests.cc b/src/bin/d2/tests/ncr_udp_unittests.cc index 4b2de7cd8c..4949364e6e 100644 --- a/src/bin/d2/tests/ncr_udp_unittests.cc +++ b/src/bin/d2/tests/ncr_udp_unittests.cc @@ -75,7 +75,7 @@ const long TEST_TIMEOUT = 5 * 1000; /// @brief A NOP derivation for constructor test purposes. class SimpleListenHandler : public NameChangeListener::RequestReceiveHandler { public: - virtual void operator ()(const NameChangeListener::Result, + virtual void operator ()(const NameChangeListener::Result, NameChangeRequestPtr&) { } }; @@ -250,7 +250,7 @@ TEST_F(NameChangeUDPListenerTest, basicReceivetest) { /// @brief A NOP derivation for constructor test purposes. class SimpleSendHandler : public NameChangeSender::RequestSendHandler { public: - virtual void operator ()(const NameChangeSender::Result, + virtual void operator ()(const NameChangeSender::Result, NameChangeRequestPtr&) { } }; @@ -259,7 +259,7 @@ public: /// This test verifies that: /// 1. Constructing with a max queue size of 0 is not allowed /// 2. Given valid parameters, the sender constructor works -/// 3. Default construction provides default max queue size +/// 3. Default construction provides default max queue size /// 4. Construction with a custom max queue size works TEST(NameChangeUDPSenderBasicTest, constructionTests) { isc::asiolink::IOAddress ip_address(TEST_ADDRESS);