Commit 68e83d82 authored by Francis Dupont's avatar Francis Dupont

[4009] error_ and system_code in system (vs asio) namespace

parent dc74a80f
......@@ -87,7 +87,7 @@ FauxServer::receive (const ResponseMode& response_mode,
}
void
FauxServer::requestHandler(const boost::asio::error_code& error,
FauxServer::requestHandler(const boost::system::error_code& error,
std::size_t bytes_recvd,
const ResponseMode& response_mode,
const dns::Rcode& response_rcode) {
......
......@@ -110,7 +110,7 @@ public:
/// @param response_mode type of response the handler should produce
/// @param response_rcode value of Rcode in the response constructed by
/// handler
void requestHandler(const boost::asio::error_code& error,
void requestHandler(const boost::system::error_code& error,
std::size_t bytes_recvd,
const ResponseMode& response_mode,
const dns::Rcode& response_rcode);
......
......@@ -102,7 +102,7 @@ argument the class of the object that will be used as the callback when the
asynchronous operation completes. This object can be of any type, but must
include an operator() method with the signature:
operator()(boost::asio::error_code ec, size_t length)
operator()(boost::system::error_code ec, size_t length)
... the two arguments being the status of the completed I/O operation and
the number of bytes transferred. (In the case of the open method, the second
......
......@@ -243,7 +243,7 @@ IOFetch::getProtocol() const {
/// pattern; see internal/coroutine.h for details.
void
IOFetch::operator()(boost::asio::error_code ec, size_t length) {
IOFetch::operator()(boost::system::error_code ec, size_t length) {
if (data_->stopped) {
return;
......@@ -402,7 +402,7 @@ IOFetch::stop(Result result) {
// Log an error - called on I/O failure
void IOFetch::logIOFailure(boost::asio::error_code ec) {
void IOFetch::logIOFailure(boost::system::error_code ec) {
// Should only get here with a known error code.
assert((data_->origin == ASIODNS_OPEN_SOCKET) ||
......
......@@ -189,7 +189,7 @@ public:
///
/// \param ec Error code, the result of the last asynchronous I/O operation.
/// \param length Amount of data received on the last asynchronous read
void operator()(boost::asio::error_code ec = boost::asio::error_code(), size_t length = 0);
void operator()(boost::system::error_code ec = boost::system::error_code(), size_t length = 0);
/// \brief Terminate query
///
......@@ -215,7 +215,7 @@ private:
/// Records an I/O failure to the log file
///
/// \param ec ASIO error code
void logIOFailure(boost::asio::error_code ec);
void logIOFailure(boost::system::error_code ec);
// Member variables. All data is in a structure pointed to by a shared
// pointer. The IOFetch object is copied a number of times during its
......
......@@ -176,7 +176,7 @@ public:
/// sent with the correct QID.
/// \param length Amount of data received.
void udpReceiveHandler(udp::endpoint* remote, udp::socket* socket,
boost::asio::error_code ec = boost::asio::error_code(),
boost::system::error_code ec = boost::system::error_code(),
size_t length = 0, bool bad_qid = false,
bool second_send = false)
{
......@@ -228,7 +228,7 @@ public:
/// \param socket Socket on which data will be received
/// \param ec Boost error code, value should be zero.
void tcpAcceptHandler(tcp::socket* socket,
boost::asio::error_code ec = boost::asio::error_code())
boost::system::error_code ec = boost::system::error_code())
{
if (debug_) {
cout << "tcpAcceptHandler(): error = " << ec.value() << endl;
......@@ -268,7 +268,7 @@ public:
/// by the "server" to receive data.
/// \param length Amount of data received.
void tcpReceiveHandler(tcp::socket* socket,
boost::asio::error_code ec = boost::asio::error_code(),
boost::system::error_code ec = boost::system::error_code(),
size_t length = 0)
{
if (debug_) {
......@@ -401,7 +401,7 @@ public:
/// \param ec Boost error code, value should be zero.
/// \param length Number of bytes sent.
void tcpSendHandler(size_t expected, tcp::socket* socket,
boost::asio::error_code ec = boost::asio::error_code(),
boost::system::error_code ec = boost::system::error_code(),
size_t length = 0)
{
if (debug_) {
......
......@@ -44,7 +44,7 @@ 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()(boost::asio::error_code) {
void operator()(boost::system::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
......@@ -58,7 +58,7 @@ 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()(boost::asio::error_code, size_t) {
void operator()(boost::system::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
......
......@@ -47,7 +47,7 @@ public:
void setup(const IntervalTimer::Callback& cbfunc, const long interval,
const IntervalTimer::Mode& interval_mode
= IntervalTimer::REPEATING);
void callback(const boost::asio::error_code& error);
void callback(const boost::system::error_code& error);
void cancel() {
timer_.cancel();
interval_ = 0;
......@@ -114,7 +114,7 @@ IntervalTimerImpl::update() {
timer_.async_wait(boost::bind(&IntervalTimerImpl::callback,
shared_from_this(),
boost::asio::placeholders::error));
} catch (const boost::asio::system_error& e) {
} catch (const boost::system::system_error& e) {
isc_throw(isc::Unexpected, "Failed to update timer: " << e.what());
} catch (const boost::bad_weak_ptr&) {
// Can't happen. It means a severe internal bug.
......@@ -123,7 +123,7 @@ IntervalTimerImpl::update() {
}
void
IntervalTimerImpl::callback(const boost::asio::error_code& ec) {
IntervalTimerImpl::callback(const boost::system::error_code& ec) {
assert(interval_ != INVALIDATED_INTERVAL);
if (interval_ == 0 || ec) {
// timer has been canceled. Do nothing.
......
......@@ -85,7 +85,7 @@ public:
///
/// This constructor may throw a standard exception if
/// memory allocation fails inside the method.
/// This constructor may also throw \c boost::asio::system_error.
/// This constructor may also throw \c boost::system::system_error.
///
/// \param io_service A reference to an instance of IOService
IntervalTimer(IOService& io_service);
......@@ -111,7 +111,7 @@ public:
/// each expiration (the default) or behave as a one-shot which will run
/// for a single interval and not reschedule.
///
/// Note: IntervalTimer will not pass \c boost::asio::error_code to
/// Note: IntervalTimer will not pass \c boost::system::error_code to
/// call back function. In case the timer is canceled, the function
/// will not be called.
///
......
......@@ -38,7 +38,7 @@ namespace asiolink {
// XXX: we cannot simply construct the address in the initialization list,
// because we'd like to throw our own exception on failure.
IOAddress::IOAddress(const std::string& address_str) {
boost::asio::error_code err;
boost::system::error_code err;
asio_address_ = ip::address::from_string(address_str, err);
if (err) {
isc_throw(IOError, "Failed to convert string to address '"
......
......@@ -26,7 +26,7 @@ namespace { // begin unnamed namespace
TEST(DummyIOCallbackTest, throws) {
DummyIOCallback cb;
boost::asio::error_code error_code;
boost::system::error_code error_code;
// All methods should throw isc::Unexpected.
EXPECT_THROW(cb(error_code), isc::Unexpected);
......
......@@ -87,7 +87,7 @@ public:
name_(""), queued_(NONE), called_(NONE), data_(MIN_SIZE, 0)
{}
boost::asio::error_code error_code_; ///< Completion error code
boost::system::error_code error_code_; ///< Completion error code
size_t length_; ///< Bytes transferred in this I/O
size_t cumulative_; ///< Cumulative bytes transferred
size_t expected_; ///< Expected amount of data
......@@ -95,7 +95,7 @@ public:
std::string name_; ///< Which of the objects this is
Operation queued_; ///< Queued operation
Operation called_; ///< Which callback called
std::vector<uint8_t> data_; ///< Receive buffer
std::vector<uint8_t> data_; ///< Receive buffer
};
/// \brief Constructor
......@@ -128,7 +128,7 @@ public:
///
/// \param ec I/O completion error code passed to callback function.
/// \param length Number of bytes transferred
void operator()(boost::asio::error_code ec = boost::asio::error_code(),
void operator()(boost::system::error_code ec = boost::system::error_code(),
size_t length = 0)
{
setCode(ec.value());
......@@ -145,7 +145,7 @@ public:
///
/// \param code New value of completion code
void setCode(int code) {
ptr_->error_code_ = boost::asio::error_code(code, boost::asio::error_code().category());
ptr_->error_code_ = boost::system::error_code(code, boost::system::error_code().category());
}
/// \brief Get number of bytes transferred in I/O
......
......@@ -74,7 +74,7 @@ public:
error_code_(), length_(0), called_(false), name_("")
{}
boost::asio::error_code error_code_; ///< Completion error code
boost::system::error_code error_code_; ///< Completion error code
size_t length_; ///< Number of bytes transferred
bool called_; ///< Set true when callback called
std::string name_; ///< Which of the objects this is
......@@ -110,7 +110,7 @@ public:
///
/// \param ec I/O completion error code passed to callback function.
/// \param length Number of bytes transferred
virtual void operator()(boost::asio::error_code ec, size_t length = 0) {
virtual void operator()(boost::system::error_code ec, size_t length = 0) {
ptr_->error_code_ = ec;
setLength(length);
setCalled(true);
......@@ -125,7 +125,7 @@ public:
///
/// \param code New value of completion code
void setCode(int code) {
ptr_->error_code_ = boost::asio::error_code(code, boost::asio::error_code().category());
ptr_->error_code_ = boost::system::error_code(code, boost::system::error_code().category());
}
/// \brief Get number of bytes transferred in I/O
......
......@@ -798,7 +798,7 @@ IfaceMgr::getLocalAddress(const IOAddress& remote_addr, const uint16_t port) {
boost::asio::io_service io_service;
boost::asio::ip::udp::socket sock(io_service);
boost::asio::error_code err_code;
boost::system::error_code err_code;
// If remote address is broadcast address we have to
// allow this on the socket.
if (remote_addr.isV4() &&
......
......@@ -39,7 +39,7 @@ UDPCallback::UDPCallback (RawBufferPtr& buffer, const size_t buf_size,
}
void
UDPCallback::operator ()(const boost::asio::error_code error_code,
UDPCallback::operator ()(const boost::system::error_code error_code,
const size_t bytes_transferred) {
// Save the result state and number of bytes transferred.
......@@ -112,7 +112,7 @@ NameChangeUDPListener::open(isc::asiolink::IOService& io_service) {
// Bind the low level socket to our endpoint.
asio_socket_->bind(endpoint.getASIOEndpoint());
} catch (boost::asio::system_error& ex) {
} catch (boost::system::system_error& ex) {
asio_socket_.reset();
isc_throw (NcrUDPError, ex.code().message());
}
......@@ -142,7 +142,7 @@ NameChangeUDPListener::close() {
if (asio_socket_->is_open()) {
try {
asio_socket_->close();
} catch (boost::asio::system_error& ex) {
} catch (boost::system::system_error& ex) {
// It is really unlikely that this will occur.
// If we do reopen later it will be with a new socket
// instance. Repackage exception as one that is conformant
......@@ -180,7 +180,7 @@ NameChangeUDPListener::receiveCompletionHandler(const bool successful,
return;
}
} else {
boost::asio::error_code error_code = callback->getErrorCode();
boost::system::error_code error_code = callback->getErrorCode();
if (error_code.value() == boost::asio::error::operation_aborted) {
// A shutdown cancels all outstanding reads. For this reason,
// it can be an expected event, so log it as a debug message.
......@@ -247,7 +247,7 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) {
// Bind the low leve socket to our endpoint.
asio_socket_->bind(endpoint.getASIOEndpoint());
} catch (boost::asio::system_error& ex) {
} catch (boost::system::system_error& ex) {
isc_throw (NcrUDPError, ex.code().message());
}
......@@ -274,7 +274,7 @@ NameChangeUDPSender::close() {
if (asio_socket_->is_open()) {
try {
asio_socket_->close();
} catch (boost::asio::system_error& ex) {
} catch (boost::system::system_error& ex) {
// It is really unlikely that this will occur.
// If we do reopen later it will be with a new socket
// instance. Repackage exception as one that is conformant
......@@ -337,7 +337,7 @@ NameChangeUDPSender::sendCompletionHandler(const bool successful,
}
else {
// On a failure, log the error and set the result to ERROR.
boost::asio::error_code error_code = send_callback->getErrorCode();
boost::system::error_code error_code = send_callback->getErrorCode();
if (error_code.value() == boost::asio::error::operation_aborted) {
LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_UDP_SEND_CANCELED)
.arg(error_code.message());
......
......@@ -56,7 +56,7 @@
///
/// The callback class must provide an operator() with the following signature:
/// @code
/// void operator ()(const boost::asio::error_code error_code,
/// void operator ()(const boost::system::error_code error_code,
/// const size_t bytes_transferred);
/// @endcode
///
......@@ -190,7 +190,7 @@ public:
size_t put_len_;
/// @brief Stores the IO layer result code of the completed IO service.
boost::asio::error_code error_code_;
boost::system::error_code error_code_;
/// @brief Stores the number of bytes transferred by completed IO
/// service.
......@@ -226,7 +226,7 @@ public:
/// For a read it is the number of bytes written into the
/// buffer. For a write it is the number of bytes read from the
/// buffer.
void operator ()(const boost::asio::error_code error_code,
void operator ()(const boost::system::error_code error_code,
const size_t bytes_transferred);
/// @brief Returns the number of bytes transferred by the completed IO
......@@ -247,14 +247,14 @@ public:
}
/// @brief Returns the completed IO layer service outcome status.
boost::asio::error_code getErrorCode() const {
boost::system::error_code getErrorCode() const {
return (data_->error_code_);
}
/// @brief Sets the completed IO layer service outcome status.
///
/// @param value is the new value to assign to outcome status.
void setErrorCode(const boost::asio::error_code value) {
void setErrorCode(const boost::system::error_code value) {
data_->error_code_ = value;
}
......
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