Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use single-parameter SetTotalBytesLimit, fix protobuf 3.18 build #130

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()
# However, if ProtobufConfig is used instead, there is a CMake option that controls
# this, which defaults to OFF. We need to force this option to ON instead.
set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE)
find_package(Protobuf 3.0.0 REQUIRED)
find_package(Protobuf 3.6.0 REQUIRED)

set(CMAKE_POSITION_INDEPENDENT_CODE ON) #Required if a patch to libArcus needs to be made via templates.

Expand Down
5 changes: 1 addition & 4 deletions src/Socket_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ namespace Arcus

static const int keep_alive_rate = 500; //Number of milliseconds between sending keepalive packets

// This value determines when protobuf should warn about very large messages.
static const int message_size_warning = 400 * 1048576;

// This value determines when protobuf should error out because the message is too large.
// Due to the way Protobuf is implemented, messages large than 512MiB will cause issues.
static const int message_size_maximum = 500 * 1048576;
Expand Down Expand Up @@ -548,7 +545,7 @@ namespace Arcus

google::protobuf::io::ArrayInputStream array(wire_message->data, wire_message->size);
google::protobuf::io::CodedInputStream stream(&array);
stream.SetTotalBytesLimit(message_size_maximum, message_size_warning);
stream.SetTotalBytesLimit(message_size_maximum);
if(!message->ParseFromCodedStream(&stream))
{
error(ErrorCode::ParseFailedError, "Failed to parse message:" + std::string(wire_message->data));
Expand Down