Repository navigation
Conversation
|
I integrated your 7bf5e52 into the fork and kept your authorship and source commit reference. One small finding: the new TCPAddr assignment drops laddr.Zone. Adding Tests and correction are available to use here. Both tests pass on Linux arm64 and native Darwin arm64 with released TinyGo 0.43.0-net.1, Go 1.26.7, isolated TINYGOROOT, and 15-second process limits. For integration with #74, Accept must retain No duplicate PR was opened. This remains your port fix. The fork's known close and poller limits are unchanged. |
|
Thank you — the Zone drop was real. Your 0f46080 is now cherry-picked here as 7b7aacb, authorship preserved. One adaptation: |
|
Please update or replace this PR to follow https://github.com/tinygo-org/net/blob/main/AGENTS.md Thank you. |
Listening on ":0" asks the kernel for an ephemeral port, but the listener kept the requested address, so ln.Addr() reported port 0 and dialing it could not work. Add GetSockname to the host netdev and look it up from listenTCP through an optional interface, so netdevs that cannot report the bound address keep their previous behavior. ListenUDP already fills in a port before binding.
(cherry picked from commit 0f46080)
7b7aacb to
c1c9fe3
Compare
|
Updated to follow AGENTS.md. The description, commit messages and comments are rewritten, and the fixup commits are gone. |
Fixes #97.
Listening on :0 asks the kernel for an ephemeral port, but the listener kept
the requested address, so ln.Addr() reported port 0. Binding an ephemeral port
and dialing ln.Addr(), the pattern httptest.NewServer uses, could not work.
Add GetSockname to the host netdev and look it up from listenTCP through an
optional interface, so netdevs that cannot report the bound address keep their
previous behavior. UDP is unaffected because ListenUDP already fills in a port
before binding.
The second commit is @yohimik's fix to preserve the listener zone when applying
the bound port, cherry picked with authorship preserved.
Verified on linux/amd64 with tinygo dev. Listen("127.0.0.1:0") reports the real
port and dialing ln.Addr().String() connects.