BIND 10 #1366: asiolink/dummy_io_cb and uncalled methods

BIND 10 Development do-not-reply at isc.org
Thu Nov 3 00:04:41 UTC 2011


#1366: asiolink/dummy_io_cb and uncalled methods
-------------------------------------+-------------------------------------
            Reporter:  jreed         |                        Owner:
                Type:  defect        |                       Status:  new
            Priority:  minor         |                    Milestone:  New
           Component:  Unclassified  |  Tasks
           Sensitive:  0             |                     Keywords:
         Sub-Project:  Core          |              Defect Severity:  N/A
Estimated Difficulty:  0             |  Feature Depending on Ticket:
         Total Hours:  0             |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
 I noticed some doxygen mistakes  (with wrong paramaters) so I was curious
 about this.

 Here is an initial idea from Stephen from two months ago.

 This patch is against a patch I made (so won't apply to master as is.)

 {{{

 diff --git a/src/lib/asiolink/dummy_io_cb.h
 b/src/lib/asiolink/dummy_io_cb.h
 index bcaefe9..90d24a8 100644
 --- a/src/lib/asiolink/dummy_io_cb.h
 +++ b/src/lib/asiolink/dummy_io_cb.h
 @@ -15,6 +15,7 @@
  #ifndef __DUMMY_IO_CB_H
  #define __DUMMY_IO_CB_H

 +#include <cassert>
  #include <iostream>

  #include <asio/error.hpp>
 @@ -39,20 +40,30 @@ public:

      /// \brief Asynchronous I/O callback method
      ///
 -    /// TODO: explain why this method should never be called.
 -    /// This should be unused.
 +    /// Should never be called, as this class is a convenience class
 provided
 +    /// for instances where a socket is required but it is known that no
 +    /// asynchronous operations will be carried out.
      void operator()(asio::error_code)
      {
 -        // TODO: log an error if this method ever gets called.
 +        // If the function is called, there is a serious logic error in
 the
 +        // program (this class should not be used as the callback class).
 As
 +        // the asiolink module is too low-level for logging errors, use
 assert()
 +        // to bug-check the program.
 +        assert(false);
      }

      /// \brief Asynchronous I/O callback method
      ///
 -    /// TODO: explain why this method should never be called.
 -    /// This should be unused.
 +    /// Should never be called, as this class is a convenience class
 provided
 +    /// for instances where a socket is required but it is known that no
 +    /// asynchronous operations will be carried out.
      void operator()(asio::error_code, size_t)
      {
 -        // TODO: log an error if this method ever gets called.
 +        // If the function is called, there is a serious logic error in
 the
 +        // program (this class should not be used as the callback class).
 As
 +        // the asiolink module is too low-level for logging errors, use
 assert()
 +        // to bug-check the program.
 +        assert(false);
      }
  };

 }}}

 Today, Stephen said: Looking at that code again, throwing an exception -
 rather than using an assert - would be better.

 Opening a ticket to take care of this.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1366>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list