clj-commons / aleph

Asynchronous streaming communication for Clojure - web server, web client, and raw TCP/UDP
http://aleph.io
MIT License
2.54k stars 241 forks source link

Randomize UDP ports #670

Closed arnaudgeiser closed 1 year ago

arnaudgeiser commented 1 year ago

Description

Since an UDP socket doesn't implement the AlephServer protocol, the port function is unavailable. Here is a quick solution to stabilize those tests.

KingMob commented 1 year ago

Hmm, I wonder how hard it would be to make the UDP code use netty/start-server, for parity. udp/socket takes almost the same options as tcp/start-server, it shouldn't be too difficult, in theory.

arnaudgeiser commented 1 year ago

Hmm, I wonder how hard it would be to make the UDP code use netty/start-server, for parity. udp/socket takes almost the same options as tcp/start-server, it shouldn't be too difficult, in theory.

I think so too. Promise, I will make a PR for it. :)

(and I will adapt the tests accordingly)

KingMob commented 1 year ago

I mean, UDP doesn't have the concepts of connections or streams, so maybe it's not going to be a good fit. It still has the concept of ports, though, so maybe we could refactor that out into something common.

This might be a bigger deal if/when we implement HTTP/3 (which requires QUIC, which is based off UDP), or it might not, if we can rely on the netty http3/quic incubator projects.