From: Mukund Sivaraman Date: Thu, 30 Jan 2014 06:20:29 +0000 (+0530) Subject: [1366] Throw an exception if DummyIOCallback() is called X-Git-Tag: bind10-1.2.0beta1-release~79^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5dfa164e058d08ab2267a6bce4501c7acc293724;p=thirdparty%2Fkea.git [1366] Throw an exception if DummyIOCallback() is called --- diff --git a/src/lib/asiolink/dummy_io_cb.h b/src/lib/asiolink/dummy_io_cb.h index 79d087d221..71d3a4ca70 100644 --- a/src/lib/asiolink/dummy_io_cb.h +++ b/src/lib/asiolink/dummy_io_cb.h @@ -15,9 +15,10 @@ #ifndef DUMMY_IO_CB_H #define DUMMY_IO_CB_H -#include #include +#include + #include #include @@ -43,13 +44,13 @@ public: /// 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) - { - // 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); + void operator()(asio::error_code) { + // 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, throw an exception. + isc_throw(isc::Unexpected, + "DummyIOCallback::operator() must not be called"); } /// \brief Asynchronous I/O callback method @@ -57,13 +58,13 @@ public: /// 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) - { - // 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); + void operator()(asio::error_code, size_t) { + // 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, throw an exception. + isc_throw(isc::Unexpected, + "DummyIOCallback::operator() must not be called"); } };