Skip to content

std.net: update to new I/O API #24409

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

std.net: update to new I/O API #24409

wants to merge 6 commits into from

Conversation

andrewrk
Copy link
Member

Plus some bonus commits.

}

pub const Adapter = struct {
derp_writer: Self,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be derp_reader (which stream tries to use).

Comment on lines -1289 to +1313
(try addrs.addOne()).* = LookupAddr{
addrs.appendAssumeCapacity(.{
.addr = Address.initIp4([1]u8{0} ** 4, port),
};
});
}
if (family != posix.AF.INET) {
(try addrs.addOne()).* = LookupAddr{
addrs.appendAssumeCapacity(.{
.addr = Address.initIp6([1]u8{0} ** 16, port, 0, 0),
};
});
}
} else {
if (family != posix.AF.INET6) {
(try addrs.addOne()).* = LookupAddr{
addrs.appendAssumeCapacity(.{
.addr = Address.initIp4([4]u8{ 127, 0, 0, 1 }, port),
};
});
}
if (family != posix.AF.INET) {
(try addrs.addOne()).* = LookupAddr{
addrs.appendAssumeCapacity(.{
.addr = Address.initIp6(([1]u8{0} ** 15) ++ [1]u8{1}, port, 0, 0),
};
});
Copy link
Contributor

Choose a reason for hiding this comment

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

When this function is called, ensureUnusedCapacity(gpa, 1) is called (line 1081), however this function can add 2 items (family != posix.AF.INET and family != posix.AF.INET6).

On a side note, this codepath seems currently unreachable; linuxLookupNameFromNull is only called if linuxLookupName is called with opt_name == null which might happen on line 1082, however linuxLookupName is only called in getAddressList on line 1012, and from there name is not nullable. Not relevant to this PR, but seems a little fishy.

@andrewrk
Copy link
Member Author

Thanks for the reviews, I'll let this through and then do another batch addressing these and more

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.

3 participants