-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
base: master
Are you sure you want to change the base?
Conversation
I don't care what C headers say. This value is never supposed to be negative.
} | ||
|
||
pub const Adapter = struct { | ||
derp_writer: Self, |
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.
I think this should be derp_reader
(which stream
tries to use).
(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), | ||
}; | ||
}); |
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.
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.
Thanks for the reviews, I'll let this through and then do another batch addressing these and more |
Plus some bonus commits.