JsonRpcConnection: Raise an exception when trying to send to disconnected clients

This commit is contained in:
Yonas Habteab 2024-02-21 12:04:40 +01:00
parent 9222a63ff7
commit 932a53449d
1 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ ConnectionRole JsonRpcConnection::GetRole() const
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
{
if (m_ShuttingDown) {
return;
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!"));
}
Ptr keepAlive (this);
@ -175,7 +175,7 @@ void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
void JsonRpcConnection::SendRawMessage(const String& message)
{
if (m_ShuttingDown) {
return;
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot send message to already disconnected API client '" + GetIdentity() + "'!"));
}
Ptr keepAlive (this);