mirror of
https://github.com/wownero/wownero.git
synced 2026-11-28 20:03:54 +01:00
net: cap aggregate ZMQ receive size
This commit is contained in:
@@ -150,6 +150,12 @@ namespace zmq
|
||||
if ((last = zmq_msg_recv(part.handle(), socket, flags)) < 0)
|
||||
return last;
|
||||
|
||||
if (max_message_size < payload.size() ||
|
||||
max_message_size - payload.size() < part.size())
|
||||
{
|
||||
errno = EMSGSIZE;
|
||||
return -1;
|
||||
}
|
||||
payload.append(part.data(), part.size());
|
||||
if (!zmq_msg_more(part.handle()))
|
||||
break;
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace net
|
||||
{
|
||||
namespace zmq
|
||||
{
|
||||
constexpr std::size_t max_message_size = 10 * 1024 * 1024; // 10 MiB
|
||||
|
||||
//! \return Category for ZMQ errors.
|
||||
const std::error_category& error_category() noexcept;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user