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

aws_socket_get_bound_address() #491

Merged
merged 1 commit into from
May 25, 2022
Merged

aws_socket_get_bound_address() #491

merged 1 commit into from
May 25, 2022

Conversation

graebm
Copy link
Contributor

@graebm graebm commented May 25, 2022

Now, if a user binds to port 0, they can query afterwards and see which port was assigned by the OS.

Issue #: #488

Adapted from: #487

Description of changes:

  • NEW: int aws_socket_get_bound_address(const struct aws_socket *socket, struct aws_socket_endpoint *out_address)
  • The socket stores this address during aws_socket_bind() call, which avoids threading issues during the aws_socket_get_bound_address() call.
  • Windows-specific:
    • Simplified some error-handling paths in Windows socket code, which fixed some subtle bugs.
    • Fixed some bugs involving structs that weren't zeroed out before use.

Co-authored-by: Vitaly Khalmansky [email protected]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Enable users to bind on port 0, which has the OS assign a port, and then query which port it ended up with.
@graebm graebm merged commit df07e42 into main May 25, 2022
@graebm graebm deleted the feature/get_bound_address branch May 25, 2022 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants