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

feat(node/net): add SocketAddress #17154

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

feat(node/net): add SocketAddress #17154

wants to merge 20 commits into from

Conversation

DonIsaac
Copy link
Contributor

@DonIsaac DonIsaac commented Feb 7, 2025

What does this PR do?

Not ready for review. Creating a draft so tests can run.

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

TODO

  • swap out JSSocketAddress
  • lots of testing
  • Make sure it plays nicely with Listener

How did you verify your code works?

Lots of tests.

@DonIsaac DonIsaac added enhancement New feature or request node:net labels Feb 7, 2025
@robobun
Copy link

robobun commented Feb 7, 2025

Updated 9:03 PM PT - Feb 10th, 2025

@DonIsaac, your commit c7045b4 has 6 failures in Build #11424:


🧪   try this PR locally:

bunx bun-pr 17154


pub fn getAddress(this: *SocketAddress, global: *JSC.JSGlobalObject) JSC.JSValue {
// TODO: check that this doesn't ref() again.
return this.address().toJS(global);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

double-ref?

@@ -2920,10 +2919,10 @@ void GlobalObject::finishCreation(VM& vm)
init.vm, reinterpret_cast<Zig::GlobalObject*>(init.owner)));
});

m_JSSocketAddressStructure.initLater(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do zig codegen'd classes also have their structures cached?

errno: ?i32 = null,
name: ?string = null,
};
pub fn throwSysError(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

global.throwValue(bun.sys.Error.fromCode(errno, syscall).toJSC(global))

@DonIsaac
Copy link
Contributor Author

DonIsaac commented Feb 8, 2025

OFC Windows doesn't have socklen_t. Needs to be swapped out with c_ares.socklen_t

@DonIsaac DonIsaac changed the title [wip] feat(node/net): add SocketAddress feat(node/net): add SocketAddress Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request node:net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants