diff --git a/asyncmsg/Error.h b/asyncmsg/Error.h index 35af88e9d596927a9796e4e724b3bfb82388dc7f..888d3fff39f8b7780a112eabc34361700db45989 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 0ef77f1a7343f71613adc4153e2e89e005bb5af5..be70f3509cdd73ff9d1d2282f237b60c5fca0850 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 234b5d740c565047fae25557589daebc31ae4fa7..a44ac83525d43811784e4c6663112f6944b1a0ba 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 2b6d372eb5bb651effc45a95ad64cadb94570a7c..b47dc80d117cc70c22b5bbcac1ecaf4f7b578afe 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) {