-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RSDK-8081 Fix max message size limit (#264)
- Loading branch information
Showing
11 changed files
with
74 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
namespace viam { | ||
namespace sdk { | ||
|
||
/// Max message size used for server builder and channel arguments. | ||
constexpr int kMaxMessageSize = 1 << 25; | ||
|
||
} // namespace sdk | ||
} // namespace viam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <viam/sdk/rpc/private/viam_grpc_channel.hpp> | ||
|
||
#include <grpcpp/create_channel.h> | ||
#include <grpcpp/support/channel_arguments.h> | ||
|
||
#include <viam/sdk/rpc/message_sizes.hpp> | ||
|
||
namespace viam { | ||
namespace sdk { | ||
namespace impl { | ||
|
||
std::shared_ptr<grpc::Channel> create_viam_channel( | ||
const grpc::string& target, const std::shared_ptr<grpc::ChannelCredentials>& credentials) { | ||
grpc::ChannelArguments args; | ||
args.SetMaxSendMessageSize(kMaxMessageSize); | ||
args.SetMaxReceiveMessageSize(kMaxMessageSize); | ||
|
||
return grpc::CreateCustomChannel(target, credentials, args); | ||
} | ||
|
||
} // namespace impl | ||
} // namespace sdk | ||
} // namespace viam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include <grpcpp/channel.h> | ||
#include <grpcpp/security/credentials.h> | ||
|
||
namespace viam { | ||
namespace sdk { | ||
namespace impl { | ||
|
||
/// @brief Like grpc::CreateChannel, but returns a channel suitable for transmitting messages of | ||
/// size kMaxMessageSize. | ||
std::shared_ptr<grpc::Channel> create_viam_channel( | ||
const grpc::string& target, const std::shared_ptr<grpc::ChannelCredentials>& credentials); | ||
|
||
} // namespace impl | ||
} // namespace sdk | ||
} // namespace viam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters