rpc: recover from oversized ZMQ requests

This commit is contained in:
selsta
2026-07-24 01:33:33 +02:00
parent 72f7fd791b
commit ee8f54697f
4 changed files with 44 additions and 10 deletions
+10
View File
@@ -42,6 +42,7 @@ const char* Message::STATUS_RETRY = "Retry";
const char* Message::STATUS_FAILED = "Failed";
const char* Message::STATUS_BAD_REQUEST = "Invalid request type";
const char* Message::STATUS_BAD_JSON = "Malformed json";
const char* Message::STATUS_REQUEST_TOO_LARGE = "Request too large";
namespace
{
@@ -245,6 +246,15 @@ epee::byte_slice BAD_JSON(const std::string& error_details)
return FullMessage::getResponse(fail, invalid);
}
epee::byte_slice REQUEST_TOO_LARGE()
{
rapidjson::Value invalid;
Message fail;
fail.status = Message::STATUS_REQUEST_TOO_LARGE;
fail.error_details = "Request exceeds maximum message size.";
return FullMessage::getResponse(fail, invalid);
}
} // namespace rpc