less magic number

This commit is contained in:
Chris Marsh 2017-07-17 15:00:13 -07:00
parent 0f10ebff43
commit c8e81c2c81

View file

@ -3,6 +3,9 @@
#include "connection.h" #include "connection.h"
#include "rapidjson/document.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 { struct RpcConnection {
enum class Opcode : uint32_t { enum class Opcode : uint32_t {
Handshake = 0, Handshake = 0,
@ -18,7 +21,7 @@ struct RpcConnection {
}; };
struct MessageFrame : public MessageFrameHeader { struct MessageFrame : public MessageFrameHeader {
char message[64 * 1024 - sizeof(MessageFrameHeader)]; char message[MaxRpcFrameSize - sizeof(MessageFrameHeader)];
}; };
enum class State : uint32_t { enum class State : uint32_t {