-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
x/os, x/net: layout tcp, ipv4/ipv6, and socket abstractions #8649
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifreund
reviewed
Apr 30, 2021
Noticed some errors from Azure CI. Gonna sign off for today and fix them tomorrow. |
marler8997
reviewed
Apr 30, 2021
6961e38
to
981dbc3
Compare
Rebasing on master should fix the freebsd CI issue |
The `Socket` abstraction was refactored to only comprise of methods that can be generically used/applied to all socket domains and protocols. A more comprehensive IPv4/IPv6 module derived from @LemonBoy's earlier work was implemented under `std.x.os.IPv4` and `std.x.os.IPv6`. Using this module, one can then combine them together into a union for example in order to optimize memory usage when dealing with socket addresses. A `TCP.Client` and `TCP.Listener` abstraction is introduced that is one layer over the `Socket` abstraction, which isolates methods that can only be applied to a "client socket" and a "listening socket". All prior tests from the `Socket` abstraction, which all previously operated assuming the socket is operating via. TCP/IP, were moved. All TCP socket options were also moved into the `TCP.Client` and `TCP.Listener` abstractions respectively away from the `Socket` abstraction. Some additional socket options from @LemonBoy's prior PR for Darwin were also moved in (i.e. SIGNOPIPE).
Use i32 instead of isize for os.timeval's for socket read/write timeouts. Add a comptime check to resolveScopeID to see if `IFNAMESIZE` is available on the host. If it is not available, return an error indicating that resolving the scope ID of a IPv6 address is not yet supported on the host platform.
Generalize `tcp.Address` into `ip.Address` given that multiple transport protocols apart from TCP (i.e. UDP) operate solely over IP.
Got CI passing all tests 😄. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Socket
abstraction was refactored to only comprise of methods that can be generically used/applied to all socket domains and protocols.A more comprehensive IPv4/IPv6 module derived from @LemonBoy's earlier work was implemented under
std.x.os.IPv4
andstd.x.os.IPv6
. Using this module, one can then combine them together into a union for example in order to optimize memory usage when storing/dealing with socket addresses.A
TCP.Client
andTCP.Listener
abstraction is introduced that is one layer over theSocket
abstraction, which isolates methods that can only be applied to a "client socket" and a "listening socket". All prior tests from theSocket
abstraction, which all previously operated assuming the socket is operating via. TCP/IP, were moved. All TCP socket options were also moved into theTCP.Client
andTCP.Listener
abstractions respectively away from theSocket
abstraction.Some additional socket options from @LemonBoy's prior PR for Darwin were also moved in (i.e. NOSIGPIPE).