Skip to content
Snippets Groups Projects
Commit 204794de authored by Tommaso Colombo's avatar Tommaso Colombo
Browse files

Error: rename SESSION_CLOSED to SESSION_NOT_OPEN for clarity

parent a68f2a0a
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ namespace asyncmsg ...@@ -11,7 +11,7 @@ namespace asyncmsg
enum class Error: enum class Error:
int int
{ {
SESSION_CLOSED, SESSION_NOT_OPEN,
SESSION_NOT_CLOSED, SESSION_NOT_CLOSED,
RESERVED_MESSAGE_TYPE, RESERVED_MESSAGE_TYPE,
UNEXPECTED_MESSAGE_TYPE, UNEXPECTED_MESSAGE_TYPE,
......
...@@ -19,8 +19,8 @@ ErrorCategory ErrorCategory::s_instance; ...@@ -19,8 +19,8 @@ ErrorCategory ErrorCategory::s_instance;
std::string ErrorCategory::message(int value) const std::string ErrorCategory::message(int value) const
{ {
if (value == static_cast<int>(Error::SESSION_CLOSED)) { if (value == static_cast<int>(Error::SESSION_NOT_OPEN)) {
return "The session is closed"; return "The session is not open";
} }
if (value == static_cast<int>(Error::SESSION_NOT_CLOSED)) { if (value == static_cast<int>(Error::SESSION_NOT_CLOSED)) {
return "The session is not closed"; return "The session is not closed";
......
...@@ -137,7 +137,7 @@ void Session::asyncClose() ...@@ -137,7 +137,7 @@ void Session::asyncClose()
// use post to avoid stack overflows if the user calls asyncClose again from onCloseError() // use post to avoid stack overflows if the user calls asyncClose again from onCloseError()
m_strand.post( m_strand.post(
[this, self] () { [this, self] () {
onCloseError(Error::SESSION_CLOSED); onCloseError(Error::SESSION_NOT_OPEN);
}); });
} }
else { else {
...@@ -169,7 +169,7 @@ void Session::asyncReceive() ...@@ -169,7 +169,7 @@ void Session::asyncReceive()
// onReceiveError() // onReceiveError()
m_strand.post( m_strand.post(
[this, self] () { [this, self] () {
onReceiveError(Error::SESSION_CLOSED, std::unique_ptr<InputMessage>()); onReceiveError(Error::SESSION_NOT_OPEN, std::unique_ptr<InputMessage>());
}); });
} }
else { else {
...@@ -251,7 +251,7 @@ void Session::asyncSend(std::unique_ptr<const OutputMessage> message) ...@@ -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() // use post to avoid stack overflows if the user calls asyncSend again from onSendError()
m_strand.post( m_strand.post(
[this, self, bareMessage] () { [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) { else if (bareMessage->typeId() >= RESERVED_MESSAGE_TYPES_BASE) {
......
...@@ -57,7 +57,7 @@ void UDPSession::asyncReceive() ...@@ -57,7 +57,7 @@ void UDPSession::asyncReceive()
// onReceiveError() // onReceiveError()
m_strand.post( m_strand.post(
[this, self] () { [this, self] () {
onReceiveError(Error::SESSION_CLOSED, std::unique_ptr<InputMessage>()); onReceiveError(Error::SESSION_NOT_OPEN, std::unique_ptr<InputMessage>());
}); });
} }
else { else {
...@@ -129,7 +129,7 @@ void UDPSession::asyncSend(std::unique_ptr<const OutputMessage> message) ...@@ -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() // use post to avoid stack overflows if the user calls asyncSend again from onSendError()
m_strand.post( m_strand.post(
[this, self, bareMessage] () { [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) { else if (bareMessage->typeId() >= RESERVED_MESSAGE_TYPES_BASE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment