Skip to content

Commit 776d3eb

Browse files
committed
Refs #22756. Apply suggestion.
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent 261a8f4 commit 776d3eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cpp/rtps/transport/asio_helpers.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ struct asio_helpers
5050
{
5151
asio::error_code ec;
5252

53+
assert(initial_buffer_value >= minimum_buffer_value);
54+
5355
final_buffer_value = initial_buffer_value;
5456
while (final_buffer_value > minimum_buffer_value)
5557
{
@@ -85,9 +87,10 @@ struct asio_helpers
8587
if (!ec)
8688
{
8789
// Last attempt was successful. Get the actual value set.
90+
int32_t max_value = static_cast<int32_t>(initial_buffer_value);
8891
BufferOptionType option;
8992
socket.get_option(option, ec);
90-
if (!ec && (option.value() >= value_to_set))
93+
if (!ec && (option.value() >= value_to_set) && (option.value() <= max_value))
9194
{
9295
final_buffer_value = option.value();
9396
return true;

0 commit comments

Comments
 (0)