From c8e81c2c8122ea0d5d1dfb36c084f5314aa77a8b Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Mon, 17 Jul 2017 15:00:13 -0700 Subject: [PATCH] less magic number --- src/rpc_connection.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rpc_connection.h b/src/rpc_connection.h index 23cc5da..5e761d0 100644 --- a/src/rpc_connection.h +++ b/src/rpc_connection.h @@ -3,6 +3,9 @@ #include "connection.h" #include "rapidjson/document.h" +// I took this from the buffer size libuv uses for named pipes; I suspect ours would usually be much smaller. +constexpr size_t MaxRpcFrameSize = 64 * 1024; + struct RpcConnection { enum class Opcode : uint32_t { Handshake = 0, @@ -18,7 +21,7 @@ struct RpcConnection { }; struct MessageFrame : public MessageFrameHeader { - char message[64 * 1024 - sizeof(MessageFrameHeader)]; + char message[MaxRpcFrameSize - sizeof(MessageFrameHeader)]; }; enum class State : uint32_t {