#endif /* NOD ENABLED */
if (t_protobufServers) {
- pbMessage.addRR(*i, luaconfsLocal->protobufExportConfig.exportTypes, udr);
+ // Max size is 64k, but we're conservative here, as other fields are added after the answers have been added
+ // If a single answer causes a too big protobuf message, it wil be dropped by queueData()
+ if (pbMessage.size() < std::numeric_limits<uint16_t>::max() / 2) {
+ pbMessage.addRR(*i, luaconfsLocal->protobufExportConfig.exportTypes, udr);
+ }
}
}
if (needCommit)
return d_rspbuf;
}
+ [[nodiscard]] size_t size() const
+ {
+ return d_msgbuf.size() + d_rspbuf.size();
+ }
+
std::string&& finishAndMoveBuf()
{
if (!d_rspbuf.empty()) {
void RemoteLogger::queueData(const std::string& data)
{
if (data.size() > std::numeric_limits<uint16_t>::max()) {
- throw std::runtime_error("Got a request to write an object of size " + std::to_string(data.size()));
+ const auto msg = "Not sending too large protobuf message";
+#ifdef WE_ARE_RECURSOR
+ SLOG(g_log<<Logger::Info<<msg<<endl,
+ g_slog->withName("protobuf")->info(Logr::Info, msg));
+#else
+ warnlog(msg);
+#endif
+ return;
}
auto runtime = d_runtime.lock();