smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.64k stars 404 forks source link

RFC: listen on all ports #814

Open chayleaf opened 11 months ago

chayleaf commented 11 months ago

This would close #809. It can also allow rebinding the UDP socket port, but that isn't implemented (granted, it's a single-line change)

I've still to create examples, tests and documentation, I'm publishing it in this state to get some feedback

codecov[bot] commented 11 months ago

Codecov Report

Merging #814 (1e7040d) into main (f9b064a) will decrease coverage by 0.06%. The diff coverage is 70.12%.

@@            Coverage Diff             @@
##             main     #814      +/-   ##
==========================================
- Coverage   79.65%   79.59%   -0.06%     
==========================================
  Files          72       72              
  Lines       27862    27947      +85     
==========================================
+ Hits        22193    22245      +52     
- Misses       5669     5702      +33     
Impacted Files Coverage Δ
src/socket/udp.rs 81.92% <68.49%> (-2.96%) :arrow_down:
src/socket/tcp.rs 96.48% <100.00%> (+<0.01%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

raftario commented 3 weeks ago

Just chiming in to show interest in the feature, not sure how to feel about the UDP implementation and method names though. Also I feel like it might make more sense to update ListenEndpoint to take an Option<u16> to reflect the existing behaviour for addresses and since binding to port 0 going from being an error to matching any port would be a massive footgun for people upgrading versions as the change wouldn't cause any compile errors.