Commit 5dfa164e authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[1366] Throw an exception if DummyIOCallback() is called

parent dcd06d51
......@@ -15,9 +15,10 @@
#ifndef DUMMY_IO_CB_H
#define DUMMY_IO_CB_H
#include <cassert>
#include <iostream>
#include <exceptions/exceptions.h>
#include <asio/error.hpp>
#include <asio/error_code.hpp>
......@@ -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");
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment