deno
deno copied to clipboard
feat(node): ref/unref for udp
I attempted on adding ref/unref for UDP. I do not expect this to be merged (as I do not think what I've done is exactly what is needed for it), but suggestions and directions would be gladly appreciated.
Related:
- Issue regarding this:
Error: Not implemented: udp.UDP.prototype.unref#20138 cargo test integration::js_unit_tests::net_testyields OK.- Didn't ran format and lint as I had problems running them (would format other files).
Bump, any thoughts?
@littledivy please review
Sorry for the linting issues, had some troubles running it at first, will fix asap when I'll get on my computer.
Hope I don't miss anything, but there is no cli/tests/unit_node/dgram_test.ts file, so I've created it.
udp ref and unref fails with
[dgram_test 009.80] [node/dgram] udp ref and unref => ./cli/tests/unit_node/dgram_test.ts:9:6
[dgram_test 009.80] error: Leaking async ops:
[dgram_test 009.80] - 1 async operation to receive a datagram message via UDP was started in this test, but never completed. This is often caused by not awaiting the result of `Deno.DatagramConn#receive` call, or not breaking out of a for await loop looping over a `Deno.DatagramConn`.
udp unref hangs indefinetly (test integration::node_unit_tests::dgram_test has been running for over 60 seconds)
@littledivy @CosminPerRam it appears there's still a failing test that leaks ops. Can you please take a look at it?
Unfortunately this beats me, @littledivy could you please take care of it (some afterwards explanations would be appreciated)?
@CosminPerRam I opened https://github.com/denoland/deno/pull/21777 with a different implementation that fixes bugs in this approach. The major one being that the promises returned by this.#listener are not ref/unrefable because they wrap the actual async op call.
Thanks, I will close this PR as that one superseeds this one.