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

[22756] Fix error handling logic in try_setting_buffer_size #5631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cpp/rtps/transport/asio_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ struct asio_helpers
final_buffer_value = option.value();
continue;
}
// Could not determine the actual value, but the option was set successfully.
// Assume the option was set to the desired value.
return true;
// Could not determine the actual value, even though the option was set successfully.
// The current buffer size is not defined.
return false;
}

final_buffer_value /= 2;
Expand All @@ -87,11 +87,11 @@ struct asio_helpers
// Last attempt was successful. Get the actual value set.
BufferOptionType option;
socket.get_option(option, ec);
if (!ec)
if (!ec && (option.value() >= value_to_set))
Copy link
Contributor

@juanlofer-eprosima juanlofer-eprosima Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super NIT: I wonder if it's possible that set results in a value greater than the one specified. I guess not, but if that was the case maybe we should fail? Or add an extra check that the value isn't greater than initial_buffer_value, just in case (not trusting asio anymore).

{
final_buffer_value = option.value();
return true;
}
return true;
}
return false;
}
Expand Down
Loading