Return WS error on closure when balance threshold exceeds

This commit is contained in:
Mo Morsi
2019-06-17 15:43:42 -04:00
committed by Nik Bougalis
parent a988b3224f
commit 7b7e3b6750
3 changed files with 37 additions and 18 deletions

View File

@@ -359,7 +359,7 @@ ServerHandlerImp::onWSMessage(
if (postResult == nullptr)
{
// The coroutine was rejected, probably because we're shutting down.
session->close();
session->close({boost::beast::websocket::going_away, "Shutting Down"});
}
}
@@ -388,7 +388,7 @@ ServerHandlerImp::processSession(
auto is = std::static_pointer_cast<WSInfoSub> (session->appDefined);
if (is->getConsumer().disconnect())
{
session->close();
session->close({boost::beast::websocket::policy_error, "threshold exceeded"});
// FIX: This rpcError is not delivered since the session
// was just closed.
return rpcError(rpcSLOW_DOWN);