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

node:dgram compatibility improvements #16446

Merged
merged 133 commits into from
Jan 21, 2025
Merged

node:dgram compatibility improvements #16446

merged 133 commits into from
Jan 21, 2025

Conversation

heimskr
Copy link
Member

@heimskr heimskr commented Jan 16, 2025

What does this PR do?

Improves the dgram module to add features and fix bugs. Adds some tests from Node.js.

  • Documentation or TypeScript types
  • Code changes

How did you verify your code works?

Added tests.

@heimskr heimskr mentioned this pull request Jan 17, 2025
9 tasks
@heimskr heimskr marked this pull request as ready for review January 21, 2025 00:12
if (nread < 0) {
return self.emit(
"error",
Object.assign(new Error("recvmsg"), {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems not great but I don't want to block merging on it

throw new ErrnoException(err, 'setBroadcast');
const handle = this[kStateSymbol].handle;
if (!handle?.socket) {
throw new Error("setBroadcast EBADF");
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should be using a using errors with codes instead of errors with messages. It sounds like we need a helper for throwing a system error with a syscall name and an errno.

*/
const handle = this[kStateSymbol].handle;
if (!handle?.socket) {
throw new Error("setMulticastTTL EBADF");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here as well

*/
const handle = this[kStateSymbol].handle;
if (!handle?.socket) {
throw new Error("setTTL EBADF");
Copy link
Collaborator

Choose a reason for hiding this comment

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

And here

byteLength += length;
byteLength += length;
} else {
throwTypeError(lexicalGlobalObject, throwScope, "Buffer.concat expects Buffer or Uint8Array"_s);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This throwTypeError -- is that throwing the error with the code property that is expected or is it not doing that?

@Jarred-Sumner Jarred-Sumner merged commit 0a0650f into main Jan 21, 2025
6 of 8 checks passed
@Jarred-Sumner Jarred-Sumner deleted the kai/dgram-test-fixes branch January 21, 2025 04:49
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