From 204794deecc387e856c15d9a28ad1a19b9a494e9 Mon Sep 17 00:00:00 2001 From: Tommaso Colombo <Tommaso.Colombo@cern.ch> Date: Tue, 21 May 2013 15:32:45 +0000 Subject: [PATCH] Error: rename SESSION_CLOSED to SESSION_NOT_OPEN for clarity --- asyncmsg/Error.h | 2 +- src/Error.cxx | 4 ++-- src/Session.cxx | 6 +++--- src/UDPSession.cxx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/asyncmsg/Error.h b/asyncmsg/Error.h index 35af88e..888d3ff 100644 --- a/asyncmsg/Error.h +++ b/asyncmsg/Error.h @@ -11,7 +11,7 @@ namespace asyncmsg enum class Error: int { - SESSION_CLOSED, + SESSION_NOT_OPEN, SESSION_NOT_CLOSED, RESERVED_MESSAGE_TYPE, UNEXPECTED_MESSAGE_TYPE, diff --git a/src/Error.cxx b/src/Error.cxx index 0ef77f1..be70f35 100644 --- a/src/Error.cxx +++ b/src/Error.cxx @@ -19,8 +19,8 @@ ErrorCategory ErrorCategory::s_instance; std::string ErrorCategory::message(int value) const { - if (value == static_cast<int>(Error::SESSION_CLOSED)) { - return "The session is closed"; + if (value == static_cast<int>(Error::SESSION_NOT_OPEN)) { + return "The session is not open"; } if (value == static_cast<int>(Error::SESSION_NOT_CLOSED)) { return "The session is not closed"; diff --git a/src/Session.cxx b/src/Session.cxx index 234b5d7..a44ac83 100644 --- a/src/Session.cxx +++ b/src/Session.cxx @@ -137,7 +137,7 @@ void Session::asyncClose() // use post to avoid stack overflows if the user calls asyncClose again from onCloseError() m_strand.post( [this, self] () { - onCloseError(Error::SESSION_CLOSED); + onCloseError(Error::SESSION_NOT_OPEN); }); } else { @@ -169,7 +169,7 @@ void Session::asyncReceive() // onReceiveError() m_strand.post( [this, self] () { - onReceiveError(Error::SESSION_CLOSED, std::unique_ptr<InputMessage>()); + onReceiveError(Error::SESSION_NOT_OPEN, std::unique_ptr<InputMessage>()); }); } else { @@ -251,7 +251,7 @@ void Session::asyncSend(std::unique_ptr<const OutputMessage> message) // use post to avoid stack overflows if the user calls asyncSend again from onSendError() m_strand.post( [this, self, bareMessage] () { - onSendError(Error::SESSION_CLOSED, std::unique_ptr<const OutputMessage>(bareMessage)); + onSendError(Error::SESSION_NOT_OPEN, std::unique_ptr<const OutputMessage>(bareMessage)); }); } else if (bareMessage->typeId() >= RESERVED_MESSAGE_TYPES_BASE) { diff --git a/src/UDPSession.cxx b/src/UDPSession.cxx index 2b6d372..b47dc80 100644 --- a/src/UDPSession.cxx +++ b/src/UDPSession.cxx @@ -57,7 +57,7 @@ void UDPSession::asyncReceive() // onReceiveError() m_strand.post( [this, self] () { - onReceiveError(Error::SESSION_CLOSED, std::unique_ptr<InputMessage>()); + onReceiveError(Error::SESSION_NOT_OPEN, std::unique_ptr<InputMessage>()); }); } else { @@ -129,7 +129,7 @@ void UDPSession::asyncSend(std::unique_ptr<const OutputMessage> message) // use post to avoid stack overflows if the user calls asyncSend again from onSendError() m_strand.post( [this, self, bareMessage] () { - onSendError(Error::SESSION_CLOSED, std::unique_ptr<const OutputMessage>(bareMessage)); + onSendError(Error::SESSION_NOT_OPEN, std::unique_ptr<const OutputMessage>(bareMessage)); }); } else if (bareMessage->typeId() >= RESERVED_MESSAGE_TYPES_BASE) { -- GitLab