Skip to content

Commit 373e64d

Browse files
authored
Merge pull request #3518 from DataDog/glopes/helper-timeout
appsec helper: add send timeouts
2 parents 1dff083 + f39ab3e commit 373e64d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

appsec/src/helper/network/broker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,19 @@ bool broker::send(
9797
// TODO: Add check to ensure buffer.size() fits in uint32_t
9898
header_t h = {"dds", (uint32_t)buffer.size()};
9999

100+
static constexpr auto timeout_header{std::chrono::milliseconds{100}};
101+
socket_->set_send_timeout(timeout_header);
102+
100103
// NOLINTNEXTLINE
101104
auto res = socket_->send(reinterpret_cast<char *>(&h), sizeof(header_t));
102105

103106
if (res != sizeof(header_t)) {
104107
return false;
105108
}
106109

110+
static constexpr auto timeout_msg_body{std::chrono::milliseconds{300}};
111+
socket_->set_send_timeout(timeout_msg_body);
112+
107113
res = socket_->send(buffer.c_str(), buffer.size());
108114

109115
return res == buffer.size();

0 commit comments

Comments
 (0)