-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bind to a list of Network Interfaces #471
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #471 +/- ##
==========================================
- Coverage 79.42% 79.32% -0.11%
==========================================
Files 27 27
Lines 11575 11597 +22
==========================================
+ Hits 9194 9199 +5
- Misses 2381 2398 +17 ☔ View full report in Codecov by Sentry. |
* is set, this list will be ignored and all the connections will go to that network interface. This option is only | ||
* supported on Linux and macOS and will be ignored on other platforms. | ||
*/ | ||
const struct aws_array_list *network_interface_names_list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have users pass a normal-ass C-array, and separate length.
const struct aws_array_list *network_interface_names_list; | |
const struct aws_byte_cursor *network_interface_names_array; | |
size_t num_network_interface_names; |
There's already precedent for this, see a few lines up:
const struct aws_http2_setting *initial_settings_array;
size_t num_initial_settings;
It's simpler for everyone to just use vanilla C arrays. Most uses of this will be in language bindings, and most other languages have their own easier-to-use way to create an array. C++ users can do: std::vector<aws_byte_cursor> names
and pass it like names.data(), names.size()
. C users can still use aws_array_list
if they want, and pass a pointer to the first item. Or simply use aws_mem_calloc()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, in S3, the precedence is array list for checksum algorithms list. I debated between char *[16] and aws_array_arraylist, but aws_byte_cursor * seems much nicer. I will update it to that.
source/connection_manager.c
Outdated
* round-robin algorithm. We picked round-robin because it is trivial to implement and good enough. We can later | ||
* update to a more complex distribution algorithm if required. | ||
*/ | ||
struct aws_array_list network_interface_names_list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: _list
makes me think aws_linked_list
struct aws_array_list network_interface_names_list; | |
struct aws_array_list network_interface_names; |
source/connection_manager.c
Outdated
? aws_array_list_length(options->network_interface_names_list) | ||
: 0; | ||
/* Ignore the network_interface_names_list if socket_options already contains a network_interface_name. */ | ||
if (manager->socket_options.network_interface_name[0] == '\0' && network_interface_names_list_length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debatable: maybe raise an error if both are set? instead of silently ignoring one of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated.
Co-authored-by: Michael Graeb <graebm@amazon.com>
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.